For a very clean shop design I want to reduce available formatting options for WooCommerce products.
The “tiny_mce_before_init” filter
WordPress has another simple filter to customize the TinyMCE tollbar. To change the toobar according tot the current post type we can access the global $post object.
Just add the following function to your themes functions.php.
function haet_custom_toolbar( $initArray ) { global $post; $post_type = get_post_type( $post->ID ); if( 'page' == $post_type ){ $initArray['toolbar1'] = 'formatselect,styleselect,|,bold,italic,|,alignleft,aligncenter,alignright,|,pastetext,removeformat,|,undo,redo,|,bullist,numlist,|,link,unlink,|,spellchecker,fullscreen'; $initArray['toolbar2'] = ''; }else if( 'product' == $post_type ){ $initArray['toolbar1'] = 'pastetext,removeformat,|,undo,redo,|,link,unlink,|,code'; $initArray['toolbar2'] = ''; } return $initArray; } add_filter( 'tiny_mce_before_init', 'haet_custom_toolbar' );
All available TinyMCE buttons in WordPress
- italic
- underline
- strikethrough
- justifyleft
- justifycenter
- justifyright
- justifyfull
- bullist
- numlist
- outdent
- indent
- paste
- unlink
- image
- cleanup
- removeformat
- formatselect
- fontselect
- fontsizeselect
- styleselect
- forecolor
- backcolor
- forecolorpicker
- backcolorpicker
- charmap
- visualaid
- anchor
- newdocument
- blockquote
- separator