当前位置:网站首页>代码实现WordPress编写文章可以调整字体字号
代码实现WordPress编写文章可以调整字体字号
2022-06-09 12:56:00 【zdb呀】
原有WordPress编辑文章是不可以给文章调整字体字号的
实现方法
把下面代码加入主题编辑器
//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');
想让它有常见中文字体选择追加上下方代码
//中文字体
function custum_fontfamily($initArray){
$initArray['font_formats'] = "微软雅黑='微软雅黑';宋体='宋体';黑体='黑体';仿宋='仿宋';楷体='楷体';隶书='隶书';幼圆='幼圆';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');
成功演示

参考博客
视频教程:https://www.bilibili.com/video/BV1VJ411k7s4
代码博客页面:https://yongwp.com/863.html
边栏推荐
- Hype plagiarism, insider fraud common NFT scams and security suggestions on opensea
- Yunna RFID asset management, advantages of RFID asset management system
- 零基础学网络:命令行(CLI)调试防火墙实战
- What is the difference between delete, drop and truncate in MySQL
- 输入一行字符(最多80个),从第location个位置开始,截取number个字符并将其输出。
- 面试题 08.08. 有重复字符串的排列组合
- [leetcode weekly race record] record of the 79th biweekly race + the 295th weekly race
- Yunna | how to manage fixed assets better? How to manage the company's fixed assets?
- Yuna | the importance of server monitoring and the role of monitoring management server
- 常见的图像分割方法
猜你喜欢

NeRF神经辐射场ECCV2020

15 Uncaught TypeError: Cannot set properties of null (setting ‘onclick‘)

Yunna RFID asset management, advantages of RFID asset management system

How to solve the worry of enterprise network with the acceleration of cloud network integration on the third anniversary of 5g licensing?

应用软件效率测试的执行策略

6000 字+,帮你搞懂互联网架构演变历程!

Weici technology completed a round of financing of more than 100 million yuan, and the core team graduated from Beijing Airlines

在腾讯连拿六个五星(下)

Basic use of canvas (obtain canvas, draw rectangle, clear screen content, animation, draw irregular graphics, circle, dotted line, draw text, color gradient, set shadow, render picture, deformation of

Take six five stars in Tencent (Part 2)
随机推荐
3.下载股票代码及其它基础信息
CNN's performance is even stronger without looking at the whole picture and the parts
不看全图看局部,CNN性能竟然更强了
AI 考生挑战高考作文,平均 1 秒生成 1 篇,水平超 75% 考生
详解mysql数据去重的三种方式
MySQL Installer 方式安装MySQL
UniswapV2周边合约学习(八)-- ExampleSwapToPrice.sol
工作到一半电脑重启
On the difference between redistemplate and stringredistemplate
pytorch:子模型参数冻结 + BN冻结
他26岁,发表论文18篇,刚把上世纪的素数猜想给证明了
面试题 05.07. 配对交换
Seven misconceptions of digital transformation
2022.5.24-----leetcode.965
Yunna | what does database monitoring generally monitor
Yuna | the importance of server monitoring and the role of monitoring management server
Import word document picture VM virtual machine network settings
面试题 08.08. 有重复字符串的排列组合
2022.6.2-----leetcode.450
15 Uncaught TypeError: Cannot set properties of null (setting ‘onclick‘)