Skip to content

Instantly share code, notes, and snippets.

@wpgaurav
Created April 9, 2020 10:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wpgaurav/7fc6909dc606f5d0580637134888fbcd to your computer and use it in GitHub Desktop.
Save wpgaurav/7fc6909dc606f5d0580637134888fbcd to your computer and use it in GitHub Desktop.
Hook/Add a custom editor.css file to Gutenberg Block editor.
<?php
add_action(
'enqueue_block_editor_assets',
function () {
$theme = wp_get_theme();
wp_enqueue_style(
'gt-main-editor-styles',
get_stylesheet_directory_uri() . '/custom-editor.css',
[],
$theme->get( 'Version' )
);
}
);
?>
@wpgaurav
Copy link
Author

wpgaurav commented Apr 9, 2020

Basic custom-editor.css file can have;
.editor-post-title__block .editor-post-title__input, .wp-block, h1, h2, h3, h4, h5, h6, p{ font-family: system-ui, Helvetica, Arial, sans-serif; } .wp-block, p{ font-size: 20px }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment