Created
September 22, 2012 02:54
-
-
Save arod2634/3764962 to your computer and use it in GitHub Desktop.
Customize Wordpress TinyMCE Editor
This file contains 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
<?php | |
// Make TinyMCE editor awesome! | |
function make_mce_awesome( $init ) { | |
$init['theme_advanced_blockformats'] = 'h2,h3,h4,p'; | |
$init['theme_advanced_buttons1_add'] = 'copy, cut, paste, redo, undo'; | |
$init['theme_advanced_buttons2_add'] = 'anchor, hr, sub, sup'; | |
$init['theme_advanced_disable'] = 'wp_help'; | |
return $init; | |
} | |
add_filter('tiny_mce_before_init', 'make_mce_awesome'); | |
add_filter( 'mce_buttons_2', 'my_mce_buttons_2' ); | |
function my_mce_buttons_2( $buttons ) { | |
array_unshift( $buttons, 'styleselect' ); | |
return $buttons; | |
} | |
add_filter( 'tiny_mce_before_init', 'my_mce_before_init' ); | |
function my_mce_before_init( $settings ) { | |
$style_formats = array( | |
array( | |
'title' => 'Button', | |
'selector' => 'a', | |
'classes' => 'btn' | |
), | |
array( | |
'title' => 'Callout Box', | |
'block' => 'div', | |
'classes' => 'callout', | |
'wrapper' => true | |
), | |
array( | |
'title' => 'Bold Red Text', | |
'inline' => 'span', | |
'styles' => array( | |
'color' => '#f00', | |
'fontWeight' => 'bold' | |
) | |
) | |
); | |
$settings['style_formats'] = json_encode( $style_formats ); | |
return $settings; | |
} | |
add_editor_style('path/to/custom/admin-styles.css'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment