Add font size dropdown to WordPress editor

This came in handy today so I thought I’d share it.

Add this snippet of code into your WordPress functions.php file and it will add a font size dropdown option in your WordPress editor.

The second function allows you to select what font type is used and also choose what font sizes should be in the dropdown. Used on WordPress 4.1.1.

function wp_editor_fontsize_filter( $buttons ) {
 array_shift( $buttons );
 array_unshift( $buttons, 'fontsizeselect');
 array_unshift( $buttons, 'formatselect');
 return $buttons;
 }
 add_filter('mce_buttons_2', 'wp_editor_fontsize_filter');
function customize_text_sizes($initArray){
 $initArray['fontsize_formats'] = "14px 15px 16px 17px 18px 19px 20px 21px 22px 23px 24px 26px 28px";
 return $initArray;
 }
 add_filter('tiny_mce_before_init', 'customize_text_sizes');

Share this


 Back to Latest News

Build a FREE Website with Wix

Create a free website with Wix.com. Customise with Wix free website builder, no coding skills needed.


Recommended Hosting


Donations

All these templates are created as donationware, if you are going to use them in a commercial project or would like to contribute, please donate:

£ GBP


Looking for information about link removal? - Click Here

Number of Templates
26

Total Downloads
51929

Daily Downloads (Avg)
42

Download Website Templates © 2017 - HTML Sitemap

Website Design by Derby Web Design