Skip to content

Instantly share code, notes, and snippets.

@paulvanbuuren
Created January 31, 2018 11:13
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 paulvanbuuren/392014094eb6f9f0006423442fc0595c to your computer and use it in GitHub Desktop.
Save paulvanbuuren/392014094eb6f9f0006423442fc0595c to your computer and use it in GitHub Desktop.
WordPress - tweaking the tinyMCE editor
/*
* Modifying TinyMCE editor to remove unused items.
*/
function wbvb_wpadmin_adjust_tinymce_options( $settings ) {
// remove pointless layout options:
$settings['theme_advanced_disable'] = 'underline,spellchecker,forecolor,justifyfull';
$settings['theme_advanced_buttons2_add'] = 'styleselect';
// adjust the primary button bar:
$settings['toolbar1'] = 'italic,|,bullist,numlist,blockquote,|,link,unlink,|,spellchecker,|,formatselect,styleselect,paste,removeformat,cleanup,|,undo,redo,hr,fullscreen';
// remove the secondary button bar:
$settings['toolbar2'] = '';
// remove the option to add a H1:
$settings['block_formats'] = 'Paragraph=p;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Preformatted=pre;';
$settings['style_formats'] = '[
{title: "Streamer", block: "aside", classes: "pullquote"},
{title: "Infoblok", block: "div", classes: "infoblock"},
{title: "Call To Action (primair)", block: "div", classes: "call-to-action"},
]';
return $settings;
}
add_filter('tiny_mce_before_init', 'wbvb_wpadmin_adjust_tinymce_options');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment