Custom TinyMCE Formatting in WordPress
/**
* The lead paragraph text
*
* If you choose the 'Lead Paragraph' formatting from the TinyMCE editor a <p>
* with the class of .lead is applied to it.
*/
.lead {
font-size: 120%;
}
<?php
/**
* TinyMCE Formatting
*
* Adds a pagraph around selected text with a class of .lead.
*
* @param array $settings Array of TinyMCE settings
* @return array Array of TinyMCE settings
*/
function mwtsn_tinymce_formatting( $settings ) {
$style_formats = array(
array(
'title' => 'Lead Paragraph',
'block' => 'p',
'classes' => 'lead',
'wrapper' => false,
),
);
$settings['style_formats'] = json_encode( $style_formats );
return $settings;
}
add_filter( 'tiny_mce_before_init', 'mkdo_tinymce_formatting' );