要覆盖Gutenberg的样式,您需要添加自己的样式表。因此,钩住enqueue_block_editor_assets
然后添加您自己的样式表,在其中以要覆盖的选择器为目标。在下面的示例中,我在自定义主题的assets/
文件夹
functions.php
:
// Add backend styles for Gutenberg.
add_action(\'enqueue_block_editor_assets\', \'gutenberg_editor_assets\');
function gutenberg_editor_assets() {
// Load the theme styles within Gutenberg.
wp_enqueue_style(\'my-gutenberg-editor-styles\', get_theme_file_uri(\'/assets/gutenberg-editor-styles.css\'), FALSE);
}
assets/gutenberg-editor-styles.css
:
.editor-post-title__input {
border: 1px solid black;
}
来源:
Creating theme editor styles for Gutenberg