WordPress Tutorial: Custom Advanced Block Formats
WordPress has a great admin user interface complimented by the TinyMCE wysiwyg editor but there are times when the default setup of TinyMCE doesn't give you the flexibility you desire. Maybe you want editors to add some code samples, or wrap a portion of text in an address tag.
Using the following code snippet you can customize the output of the TinyMCE block format drop down list. Simply copy the code to your functions.php.
function fb_change_mce_buttons( $initArray ) {
//@see http://tinymce.moxiecode.com/wiki.php/Configuration:theme_advanced_blockformats
$initArray['theme_advanced_blockformats'] = 'h1,h2,h3,h4,h5,h6,p,div,blockquote,code,samp,address,dt,dd';
$initArray['theme_advanced_disable'] = 'forecolor';
return $initArray;
}
add_filter('tiny_mce_before_init', 'fb_change_mce_buttons');
This is a great way to tailor the TinyMCE experience to your editors requirements.
Looking for Expert WordPress or Drupal development?
I am a freelance website developer and designer based in the UK. I work as a remote Drupal developer, WordPress developer and Front-end developer for a variety of startups, charities and international businesses in Bristol, Bath, London and Europe. You can learn more about me by visiting my resume page.
Get in touch for a free quote on your next project and if you want to connect me with then check out my LinkedIn profile.