I'm using the WordPress plugin Advanced TinyMCE to give my client the ability to change font sizes within the editor. My issue is, it has a predefined set of sizes to choose and I need to add more to this. Is there an easy way to hook onto this plugin to extend it?
Asked
Active
Viewed 4,775 times
1
-
1The TinyMCE Advanced plugin has an option to replace the size setting available for fonts with: 8px 10px 12px 14px 16px 20px 24px 28px 32px 36px 48px 60px 72px 96px. Is that insufficient? – j08691 Jun 07 '17 at 15:44
-
No. That's too limited. Nothing for size 17, 18, and 19px is too restrictive. – user1702965 Jun 07 '17 at 16:14
-
The author of the TinyMCE Advanced plugin also wrote a plugin to edit the TinyMCE editor settings (https://wordpress.org/plugins/advanced-tinymce-configuration/). You should be able to use that to modify the font size settings (https://stackoverflow.com/questions/28132337/getting-the-tinymce-4-font-sizes-drop-down-to-set-the-font-size-in-px-instead-of) – j08691 Jun 07 '17 at 16:18
1 Answers
12
got this one from WP explorer- link included for further reading as there's more useful stuff. Bear in mind it was written for 3.9 so definitely worth testing before deploying.
Adding something like this to your functions.php file should do the trick, you can edit the available sizes by adding to the array:
// Customize mce editor font sizes
if ( ! function_exists( 'wpex_mce_text_sizes' ) ) {
function wpex_mce_text_sizes( $initArray ){
$initArray['fontsize_formats'] = "9px 10px 12px 13px 14px 16px 18px 21px 24px 28px 32px 36px";
return $initArray;
}
}
add_filter( 'tiny_mce_before_init', 'wpex_mce_text_sizes' );
link below for further reading: WP Explorer Tiny MCE customisations

designbypete
- 169
- 5