Skip to content

Instantly share code, notes, and snippets.

@mjot
Created November 17, 2016 10:10
Show Gist options
  • Save mjot/97c5f7ec3a6298a1a1bcd4c1348d1ea9 to your computer and use it in GitHub Desktop.
Save mjot/97c5f7ec3a6298a1a1bcd4c1348d1ea9 to your computer and use it in GitHub Desktop.
Add Custom Classes to the styleselect Dropdown from the WYSIWYG Editor
/**
* Custom Classes for the wordpress WYSIWYG editor
*/
add_filter( 'tiny_mce_before_init', 'custom_mce_before_init' );
function custom_mce_before_init( $settings ) {
$style_formats = array(
array(
'title' => 'Title for style',
'selector' => 'li',
'classes' => 'special',
'wrapper' => false,
)
);
$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