Created
January 14, 2016 14:58
-
-
Save stephenbelyea/94e82748c72760f57c94 to your computer and use it in GitHub Desktop.
Enable MCE Format Tool in WP
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 format dropdown for MCE. | |
add_filter( 'mce_buttons_2', 'my_mce_editor_buttons' ); | |
function my_mce_editor_buttons( $buttons ) { | |
array_unshift( $buttons, 'styleselect' ); | |
return $buttons; | |
} | |
// Add SMALL and LEAD (from Bootstrap) text options. | |
add_filter( 'tiny_mce_before_init', 'my_mce_before_init' ); | |
function my_mce_before_init( $settings ) { | |
$style_formats = array( | |
array( | |
'title' => 'Small Text', | |
'inline' => 'small' | |
), | |
array( | |
'title' => 'Lead Block', | |
'block' => 'div', | |
'classes' => 'lead' | |
) | |
); | |
$settings['style_formats'] = json_encode( $style_formats ); | |
return $settings; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment