如何在wordpress中自定义字体大小为TinyMCE选择?
我试图返回一个自定义的字体大小列表,而不使用Wordpress插件。下面是我当前尝试使用的函数。我使用了类似的功能来定制颜色选择器和格式选择,但这一点运气都不好。感谢您的帮助如何在wordpress中自定义字体大小为TinyMCE选择?,wordpress,tinymce,font-size,Wordpress,Tinymce,Font Size,我试图返回一个自定义的字体大小列表,而不使用Wordpress插件。下面是我当前尝试使用的函数。我使用了类似的功能来定制颜色选择器和格式选择,但这一点运气都不好。感谢您的帮助 function mycustom_change_tinymce_fontsize( $init ) { $custom_sizes = '"14pt", "18pt"'; $init['fontsize_formats'] = '['.$custom_sizes.']'; return $init
function mycustom_change_tinymce_fontsize( $init ) {
$custom_sizes = '"14pt", "18pt"';
$init['fontsize_formats'] = '['.$custom_sizes.']';
return $init;
}
add_filter('tiny_mce_before_init', 'mycustom_change_tinymce_fontsize');
您的格式化值不正确;只需按照以下方法操作即可:
function mycustom_change_tinymce_fontsize( $init ) {
//$init['fontsize_formats'] = "10px 11px 12px 13px 14px 15px 16px 17px 18px 19px 20px 21px 22px 23px 24px 25px 26px 27px 28px 29px 30px 32px";
$init['fontsize_formats'] = "14pt 18pt";
return $init;
}
add_filter('tiny_mce_before_init', 'mycustom_change_tinymce_fontsize', 12); //-->somewhat important '12', at least more than 10 to keep your changes;