Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
//* Add custom styles to the Styles drop down menu in the TinyMCE Editor
//* @link http://anythinggraphic.net/custom-styles-in-wordpress-editor
function themeit_mce_buttons_2( $buttons ) {
array_unshift( $buttons, 'styleselect' );
return $buttons;
}
add_filter( 'mce_buttons_2', 'themeit_mce_buttons_2' );
function themeit_tiny_mce_before_init( $settings ) {
$style_formats = array(
array( 'title' => 'Orange Bordered Button', 'inline' => 'span', 'classes' => 'orange-bordered-button button' ),
array( 'title' => 'Slightly Larger Blue Text', 'inline' => 'span', 'classes' => 'color-blue bigger' ),
);
$settings['style_formats'] = json_encode( $style_formats );
return $settings;
}
add_filter( 'tiny_mce_before_init', 'themeit_tiny_mce_before_init' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.