Last active
October 12, 2022 04:25
-
-
Save Yokann/d2fa5c27196a091a79f7 to your computer and use it in GitHub Desktop.
Add font size button into Wordpress TinyMCE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | |
// Customize mce editor font sizes | |
function wp_mce_text_sizes( $initArray ){ | |
$initArray['theme_advanced_font_sizes'] = "9px 10px 12px 13px 14px 16px 18px 21px 24px 28px 32px 36px"; | |
$initArray['fontsize_formats'] = "9px 10px 12px 13px 14px 16px 18px 21px 24px 28px 32px 36px"; | |
return $initArray; | |
} | |
add_filter( 'tiny_mce_before_init', 'wp_mce_text_sizes' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment