Skip to content

Instantly share code, notes, and snippets.

@nicomollet
Last active August 29, 2015 14:07
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 nicomollet/4b022a3204ab96314da9 to your computer and use it in GitHub Desktop.
Save nicomollet/4b022a3204ab96314da9 to your computer and use it in GitHub Desktop.
Wordpress Editor Styles
<?php
function custom_tinymce_styles( $settings ) {
$style_formats_original = json_decode( $settings['style_formats'] );
$style_formats = array(
// Inline style
array(
'title' => 'Color Red',
'inline' => 'span',
'classes' => 'red',
),
// Selector style
array(
'title' => 'Button Info',
'selector' => 'a',
'classes' => 'btn btn-info',
),
// Block style
array(
'title' => 'Big',
'block' => 'p',
'classes' => 'big',
),
);
$settings['style_formats'] = json_encode( array_merge( $style_formats, $style_formats_original ) );
return $settings;
}
add_filter( 'tiny_mce_before_init', 'custom_tinymce_styles', 100 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment