Last active
December 19, 2018 13:30
-
-
Save jeremyHixon/3a989034d61f324ecb7dc2284c72ed71 to your computer and use it in GitHub Desktop.
WordPress 5.0's Gutenberg editor requires enqueuing of the stylesheet as well as adding support for said editor styles before it will work properly.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add this into your functions.php file. | |
*/ | |
/** | |
* Adding theme support | |
*/ | |
if ( !function_exists( 'rwp_after_setup_theme' ) ) { | |
function rwp_after_setup_theme() { | |
add_theme_support( 'editor-styles' ); | |
} | |
} | |
add_action( 'after_setup_theme', 'rwp_after_setup_theme' ); | |
/** | |
* Adding editor stylesheet | |
* Replace {stylesheet_uri} with the URI to your editor/Gutenberg stylesheet. | |
*/ | |
if ( !function_exists( 'rwp_admin_init' ) ) { | |
function rwp_admin_init() { | |
add_editor_style( get_theme_file_uri( '{stylesheet_uri}' ) ); | |
} | |
} | |
add_action( 'admin_init', 'rwp_admin_init' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment