Created
September 21, 2017 11:45
-
-
Save dendeffe/d0549757a1001fc7efcd9ed4d08974f0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// | |
// Set extra styles for TINY MCE | |
// 1. Enable the styles dropdown | |
add_filter( 'mce_buttons_2', 'my_mce_buttons_2' ); | |
function my_mce_buttons_2( $buttons ) { | |
array_unshift( $buttons, 'styleselect' ); | |
return $buttons; | |
} | |
// 2. Add the correct style | |
add_filter( 'tiny_mce_before_init', 'my_mce_before_init' ); | |
function my_mce_before_init( $init_array ) { | |
$style_formats = array ( | |
/* | |
array( | |
'title' => '.feature_full', | |
'block' => 'p', | |
'classes' => 'feature_full', | |
'wrapper' => false | |
), | |
*/ | |
array( | |
'title' => 'Lijst met tussenlijnen', | |
'selector' => 'ul', | |
'classes' => 'lines', | |
), | |
array( | |
'title' => 'Kleine letters', | |
'selector' => 'p', | |
'classes' => 'small', | |
), | |
array( | |
'title' => 'Kleine letters onder knop', | |
'selector' => 'p', | |
'classes' => 'button_subscript', | |
), | |
array( | |
'title' => 'Catalogus', | |
'selector' => 'p', | |
'classes' => 'catalog', | |
), | |
array( | |
'title' => 'Knop', | |
'selector' => 'p', | |
'classes' => 'button', | |
), | |
array( | |
'title' => 'Titel extra aandacht', | |
'selector' => 'h3', | |
'classes' => 'extra_attention', | |
), | |
array( | |
'title' => 'Tekst extra aandacht', | |
'selector' => 'p', | |
'classes' => 'extra_attention', | |
) | |
); | |
$init_array['style_formats'] = json_encode( $style_formats ); | |
return $init_array; | |
} | |
// 3. Show the styles in the backend | |
function my_theme_add_editor_styles() { | |
add_editor_style(); | |
} | |
add_action( 'admin_init', 'my_theme_add_editor_styles' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment