当前位置:网站首页>Code implementation WordPress writing articles can adjust font size
Code implementation WordPress writing articles can adjust font size
2022-06-09 14:07:00 【ZDB】
The original WordPress Editing an article is not allowed to adjust the font size of the article
Implementation method
Add the following code to the theme editor 
//tinymce add bottom
function add_more_buttons($buttons) {
$buttons[] = 'hr';
$buttons[] = 'del';
$buttons[] = 'sub';
$buttons[] = 'sup';
$buttons[] = 'fontselect';
$buttons[] = 'fontsizeselect';
$buttons[] = 'cleanup';
$buttons[] = 'styleselect';
$buttons[] = 'wp_page';
$buttons[] = 'anchor';
$buttons[] = 'backcolor';
return $buttons;
}
add_filter("mce_buttons_3", "add_more_buttons");
function customize_text_sizes($initArray){
$initArray['fontsize_formats'] = "12px 13px 14px 15px 16px 17px 18px 19px 20px 21px 22px 23px 24px 25px 26px 27px 28px 29px 30px 32px 34px 36px 38px 42px 44px 46px 48px";
return $initArray;
}
add_filter('tiny_mce_before_init', 'customize_text_sizes');
If you want it to have common Chinese fonts, add the upper and lower codes
// Chinese Fonts
function custum_fontfamily($initArray){
$initArray['font_formats'] = " Microsoft YaHei =' Microsoft YaHei '; Song style =' Song style '; In black =' In black '; Imitation song =' Imitation song '; Regular script =' Regular script '; Official script =' Official script '; Juvenility =' Juvenility ';ClearSans='clear_sansregular',Helvetica,Arial,sans-serif;ClearSans Medium='clear_sans_mediumregula',Helvetica,Arial,sans-serif;ClearSans Light='clear_sans_lightregular',Helvetica,Arial,sans-serif;ClearSans Thin='clear_sans_thinregular',Helvetica,Arial,sans-serif";
return $initArray;
}
add_filter('tiny_mce_before_init', 'custum_fontfamily');
Successful demonstration

Reference blog
Video tutorial :https://www.bilibili.com/video/BV1VJ411k7s4
Code blog page :https://yongwp.com/863.html
边栏推荐
猜你喜欢
随机推荐
面试题 08.04. 幂集
What's the use of finding amino acids in extraterrestrial life?
颠覆认知!数据增强、正则化可导致不易察觉的灾难?
TCP(滑动窗口,流量控制)
打蛇打七寸
面试题 05.04. 下一个数
win11启用多用户远程桌面同时登陆
从最优化的角度看待Softmax损失函数
Uniswapv2 peripheral contract learning (VII) -- exampleslidingwindoworacle sol
Take six five stars in Tencent (Part 2)
WordPress地址(URL)修改后打不开网站的解决方法
【深度优先搜索】玩具蛇:迷宫问题
UniswapV2周边合约学习(九)-- ExampleCombinedSwapAddRemoveLiquidity.sol
智慧农业小麦室外病虫害防治规范,北斗农业
浅谈RedisTemplate和StringRedisTemplate的区别
MySQL数据库(25):外键 foreing key
功能强大的开发板
“地球外存在生命之源”上热搜,外星发现氨基酸到底有什么用?
[Ji Wang] review of Cisco final multiple choice questions
面试题 08.01. 三步问题









