Last active
August 29, 2015 13:57
-
-
Save shelleyhoward/9392617 to your computer and use it in GitHub Desktop.
Custom TinyMCE
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
// TinyMCE: First line toolbar customizations | |
if( !function_exists('base_extended_editor_mce_buttons') ){ | |
function base_extended_editor_mce_buttons($buttons) { | |
// The settings are returned in this array. Customize to suite your needs. | |
return array( | |
'formatselect', 'styleselect', 'bold', 'italic', 'strikethrough', 'separator', 'bullist', 'numlist', 'blockquote', 'separator', 'justifyleft', 'justifycenter', 'justifyright', 'separator', 'link', 'unlink', 'separator', 'spellchecker', 'wp_adv' | |
); | |
/* WordPress Default | |
return array( | |
'bold', 'italic', 'strikethrough', 'separator', | |
'bullist', 'numlist', 'blockquote', 'separator', | |
'justifyleft', 'justifycenter', 'justifyright', 'separator', | |
'link', 'unlink', 'wp_more', 'separator', | |
'spellchecker', 'fullscreen', 'wp_adv' | |
); */ | |
} | |
add_filter("mce_buttons", "base_extended_editor_mce_buttons", 0); | |
} | |
// TinyMCE: Second line toolbar customizations | |
if( !function_exists('base_extended_editor_mce_buttons_2') ){ | |
function base_extended_editor_mce_buttons_2($buttons) { | |
// The settings are returned in this array. Customize to suite your needs. An empty array is used here because I remove the second row of icons. | |
return array('forecolor', 'separator', 'pastetext', 'pasteword', 'removeformat', 'separator', 'charmap', 'separator', 'outdent', 'indent','spellchecker', 'separator', 'undo', 'redo', 'wp_help'); | |
/* WordPress Default | |
return array( | |
'formatselect', 'underline', 'justifyfull', 'forecolor', 'separator', | |
'pastetext', 'pasteword', 'removeformat', 'separator', | |
'media', 'charmap', 'separator', | |
'outdent', 'indent', 'separator', | |
'undo', 'redo', 'wp_help' | |
); */ | |
} | |
add_filter("mce_buttons_2", "base_extended_editor_mce_buttons_2", 0); | |
} | |
// Customize the format dropdown items | |
if( !function_exists('base_custom_mce_format') ){ | |
function base_custom_mce_format($init) { | |
// Add block format elements you want to show in dropdown | |
$init['theme_advanced_blockformats'] = 'p,h2,h3,h4,h5,h6'; | |
// Add elements not included in standard tinyMCE dropdown p,h1,h2,h3,h4,h5,h6 | |
//$init['extended_valid_elements'] = 'code[*]'; | |
return $init; | |
} | |
add_filter('tiny_mce_before_init', 'base_custom_mce_format' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment