Skip to content

Instantly share code, notes, and snippets.

@zgordon
Last active October 11, 2023 13:50
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zgordon/ce88e48b51bebbb87830290247a02e37 to your computer and use it in GitHub Desktop.
Save zgordon/ce88e48b51bebbb87830290247a02e37 to your computer and use it in GitHub Desktop.
This example shows how to use enqueue_block_assets to enqueue custom block CSS on the frontend of a theme and in the Gutenberg editor.
<?php
/**
* Enqueue block styles on frontend and in editor
*
*/
function mytheme_block_styles() {
wp_enqueue_style( 'mytheme-blocks', get_stylesheet_directory_uri() . '/css/blocks.css' );
}
add_action( 'enqueue_block_assets', 'mytheme_block_styles' );
@ceduardogodoi
Copy link

Thank you! It helped me to add a font family to the Gutenberg editor iframe for mobile and tablet preview.

👍

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