WordPress 3.9 TinyMCE4 Custom Styles
WP 3.9 TINYMCE4 modifications:
I added this:
function mce_mod( $init ) {
$init[‘block_formats’] = ‘Paragraph=p;Heading 2=h2;Heading 3=h3;Heading 4=h4’;
$style_formats = array (
array( ‘title’ => ‘testimonial’, ‘block’ => ‘blockquote’, ‘classes’ => ‘testimonial’ ),
array( ‘title’ => ‘bold but not LOUD text’, ‘inline’ => ‘span’, ‘styles’ => array( ‘font-weight’ => ‘bold’ ) ),
);
$init[‘style_formats’] = json_encode( $style_formats );
$init[‘style_formats_merge’] = false;
return $init;
}
add_filter(‘tiny_mce_before_init’, ‘mce_mod’);
function mce_add_buttons( $buttons ){
array_splice( $buttons, 1, 0, ‘styleselect’ );
return $buttons;
}
add_filter( ‘mce_buttons_2’, ‘mce_add_buttons’ );
to yoo_master/functions.php —
I also added my styles to wp-content.css at
wp-includes/js/tinymce/skins/wordpress/wp-content.css
Tags: WordPress