Skip to content

Instantly share code, notes, and snippets.

@diegochavez
Created August 28, 2013 05:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diegochavez/6362291 to your computer and use it in GitHub Desktop.
Save diegochavez/6362291 to your computer and use it in GitHub Desktop.
Wordpress: Useful code to modify the TinyMCE drop-down menu == reference: http://justintadlock.com/archives/2011/05/02/dealing-with-shortcode-madness#comment-335205
// Your should include this in to your functions theme
add_filter('mce_buttons_2', 'wpse3882_mce_buttons_2');
function wpse3882_mce_buttons_2($buttons)
{
array_unshift($buttons, 'styleselect');
return $buttons;
}
add_filter('tiny_mce_before_init', 'wpse3882_tiny_mce_before_init');
function wpse3882_tiny_mce_before_init($settings)
{
$style_formats = array(
array('title' => 'Note', 'block' => 'p', 'classes' => 'note'),
);
$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