Apply pluggable function wrapper to inc/editor.php

This commit is contained in:
Alex Wright 2018-03-28 10:42:05 -05:00
parent 5eae85e137
commit 554f362643
1 changed files with 51 additions and 44 deletions

View File

@ -8,23 +8,27 @@
/** /**
* Registers an editor stylesheet for the theme. * Registers an editor stylesheet for the theme.
*/ */
function understrap_wpdocs_theme_add_editor_styles() {
if ( ! function_exists ( 'understrap_wpdocs_theme_add_editor_styles' ) ) {
function understrap_wpdocs_theme_add_editor_styles() {
add_editor_style( 'css/custom-editor-style.min.css' ); add_editor_style( 'css/custom-editor-style.min.css' );
}
add_action( 'admin_init', 'understrap_wpdocs_theme_add_editor_styles' );
} }
add_action( 'admin_init', 'understrap_wpdocs_theme_add_editor_styles' );
// Add TinyMCE style formats. // Add TinyMCE style formats.
add_filter( 'mce_buttons_2', 'understrap_tiny_mce_style_formats' ); add_filter( 'mce_buttons_2', 'understrap_tiny_mce_style_formats' );
function understrap_tiny_mce_style_formats( $styles ) { if ( ! function_exists ( 'understrap_tiny_mce_style_formats' ) ) {
function understrap_tiny_mce_style_formats( $styles ) {
array_unshift( $styles, 'styleselect' ); array_unshift( $styles, 'styleselect' );
return $styles; return $styles;
}
} }
add_filter( 'tiny_mce_before_init', 'understrap_tiny_mce_before_init' ); if ( ! function_exists ( 'understrap_tiny_mce_before_init' ) ) {
function understrap_tiny_mce_before_init( $settings ) {
function understrap_tiny_mce_before_init( $settings ) {
$style_formats = array( $style_formats = array(
array( array(
@ -62,4 +66,7 @@ function understrap_tiny_mce_before_init( $settings ) {
$settings['style_formats'] = json_encode( $style_formats ); $settings['style_formats'] = json_encode( $style_formats );
return $settings; return $settings;
}
} }
add_filter( 'tiny_mce_before_init', 'understrap_tiny_mce_before_init' );