• I know how to change what is displayed and add my own custom buttons for short-codes or anything else in TinyMCE using filters such as:

    add_filter('tiny_mce_before_init', 'my_tiny_mce_before_init');

    but I can’t figure out how change the font sizes in the fontsizeselect of TinyMCE, just have the option to add or remove it. I’d like to remove the option of 8pt, 10pt and add a different increment to maintain the styles used in the theme plus a few variations so no one can go too crazy with different font-sizes but do have some choice.

    Cheers

Viewing 3 replies - 1 through 3 (of 3 total)
  • Did you find the answer? If not here it is

    // Add custom text sizes in the font size drop down list of the rich text editor (TinyMCE) in WordPress
    // $initArray is a variable of type array that contains all default TinyMCE parameters.
    // Value 'theme_advanced_font_sizes' needs to be added, if an overwrite to the default font sizes in the list, is needed.
    
    function customize_text_sizes($initArray){
       $initArray['theme_advanced_font_sizes'] = "10px,11px,12px,13px,14px,15px,16px,17px,18px,19px,20px,21px,22px,23px,24px,25px,26px,27px,28px,29px,30px,32px,48px";
       return $initArray;
    }
    
    // Assigns customize_text_sizes() to "tiny_mce_before_init" filter
    add_filter('tiny_mce_before_init', 'customize_text_sizes');

    Thanks to

    Thread Starter mtpultz

    (@mtpultz)

    Beauty! Thanks, I didn’t figured it out just ended up going with it, but no longer. Thanks for the post ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to change font size displayed by TinyMCE?’ is closed to new replies.