Last active
August 29, 2015 13:56
-
-
Save barbwiredmedia/8815099 to your computer and use it in GitHub Desktop.
Wordpress -3.8 wysiwyg change options available to your user mce options. (colors, HEX, tags) Add more buttons to tiny mce (hr,sup,) (This no longer works in Wordpress 3.9+) Controls: http://www.tinymce.com/wiki.php/Controls
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
// change buttons in WYSWIG post editor, edit color palette | |
function change_mce_options( $init ) { | |
$init['theme_advanced_blockformats'] = 'p,address,h2,h3,h4,h5,h6,'; // add tag you want to be available (h1,pre,code) | |
$init['theme_advanced_disable'] = ''; // includes numlist,blockquote,justifyright,justifycenter,pasteword,pastetext etc. | |
$init['theme_advanced_text_colors'] = 'FF00FF,FFFF00,000000'; //add your themes colors here | |
$init['theme_advanced_more_colors'] = false; | |
return $init; | |
} | |
add_filter('tiny_mce_before_init', 'change_mce_options'); | |
function enable_more_buttons($buttons) { | |
$buttons[] = 'hr'; | |
/* | |
Repeat with any other buttons you want to add, e.g. | |
$buttons[] = 'fontselect'; | |
$buttons[] = 'sup'; | |
*/ | |
return $buttons; | |
} | |
add_filter("mce_buttons", "enable_more_buttons"); // add to first row | |
//add_filter("mce_buttons_2", "enable_more_buttons"); // add to second row | |
//add_filter("mce_buttons_3", "enable_more_buttons"); // add to third row |
Color changing can be utilized with the following in WP 3.9+
http://stackoverflow.com/questions/23171247/add-custom-text-color-wordpress-3-9-tinymce-4-visual-editor:
function my_mce4_options( $init ) {
$default_colours = '
"66CCFF", "Light Blue", "005581", "Thor Blue", "01152E", "Dark Blue", "FF0000", "Red", "C0C0C0", "Silver", "000000", "Black",
';
$init['textcolor_map'] = '['.$default_colours.']';
return $init;
}
add_filter('tiny_mce_before_init', 'my_mce4_options');
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This no longer work in Wordpress 3.9+