Created
November 12, 2012 22:30
-
-
Save benklocek/4062437 to your computer and use it in GitHub Desktop.
Wordpress Functions: Add Style Dropdown to TinyMCE
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 the Style Dropdown Menu to the second row of visual editor buttons | |
function bracia_mce_buttons_2($buttons){ | |
array_unshift($buttons, 'styleselect'); | |
return $buttons; | |
} | |
add_filter('mce_buttons_2', 'bracia_mce_buttons_2'); | |
function bracia_tiny_mce_before_init( $settings ) { | |
$style_formats = array( | |
// array( | |
// 'title' => 'Download Link', | |
// 'selector' => 'a', | |
// 'classes' => 'download' | |
// ), | |
// array( | |
// 'title' => 'Testimonial', | |
// 'selector' => 'p', | |
// 'classes' => 'testimonial', | |
// ), | |
array( | |
'title' => 'Special Div', | |
'block' => 'div', | |
'classes' => 'special', | |
'wrapper' => true | |
) | |
); | |
$settings['style_formats'] = json_encode( $style_formats ); | |
return $settings; | |
} | |
add_filter( 'tiny_mce_before_init', 'bracia_tiny_mce_before_init' ); | |
add_editor_style(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment