Skip to content

Instantly share code, notes, and snippets.

@anythinggraphic
Created January 31, 2015 16:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anythinggraphic/8f0574a58a71f7d6ec2c to your computer and use it in GitHub Desktop.
Save anythinggraphic/8f0574a58a71f7d6ec2c to your computer and use it in GitHub Desktop.
<?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