Last active
September 30, 2015 04:08
-
-
Save philJohnson/8438e857dbc06265fe11 to your computer and use it in GitHub Desktop.
Tiny MCE advanced formats
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function my_mce_css() { | |
return get_bloginfo('template_url').'/css/editor-style.css'; | |
} | |
add_filter( 'mce_css', 'my_mce_css' ); | |
add_filter( 'tiny_mce_before_init', 'my_mce_before_init_insert_formats' ); | |
function my_mce_before_init_insert_formats( $settings ) { | |
$style_formats = array( | |
array( | |
'title' => 'Lead Paragraph', | |
'selector' => 'p', | |
'classes' => 'lead_paragraph' | |
), | |
array( | |
'title' => 'Red', | |
'inline' => 'span', | |
'classes' => 'red' | |
), | |
array( | |
'title' => 'Button', | |
'selector' => 'a', | |
'classes' => 'button' | |
), | |
array( | |
'title' => 'Red Button', | |
'selector' => 'a', | |
'classes' => 'button red' | |
), | |
array( | |
'title' => '2 Columns', | |
'block' => 'div', | |
'wrapper' => true, | |
'classes' => 'columns' | |
), | |
); | |
$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