Last active
August 29, 2015 14:07
-
-
Save nicomollet/4b022a3204ab96314da9 to your computer and use it in GitHub Desktop.
Wordpress Editor Styles
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
<?php | |
function custom_tinymce_styles( $settings ) { | |
$style_formats_original = json_decode( $settings['style_formats'] ); | |
$style_formats = array( | |
// Inline style | |
array( | |
'title' => 'Color Red', | |
'inline' => 'span', | |
'classes' => 'red', | |
), | |
// Selector style | |
array( | |
'title' => 'Button Info', | |
'selector' => 'a', | |
'classes' => 'btn btn-info', | |
), | |
// Block style | |
array( | |
'title' => 'Big', | |
'block' => 'p', | |
'classes' => 'big', | |
), | |
); | |
$settings['style_formats'] = json_encode( array_merge( $style_formats, $style_formats_original ) ); | |
return $settings; | |
} | |
add_filter( 'tiny_mce_before_init', 'custom_tinymce_styles', 100 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment