WordPress给编辑器增加调节字号,字体颜色即,做一个增强版的编辑器如何操作?

一段代码搞定wordpress 编辑器增强版代码,增加字体选择及大小设置等

WordPress adds to the editor to adjust the font size, font color, that is, how to make an enhanced editor?
A piece of code to get the wordpress editor to add code, increase font selection and size settings to enter the WordPress backend, click Appearance-Edit on the left, and then Template functions (functions.php) on the right
Add the following code at the bottom of the document and click to update the file. You can see that there is an extra line in the editor.
In fact, these are enough for us. If you are not satisfied, you can continue to search some fields online, just change $buttons[] = ‘change me’;
function MBT_add_editor_buttons($buttons) {$buttons[] ='fontselect';$buttons[] ='fontsizeselect';$buttons[] ='cleanup';$buttons[] ='styleselect';$buttons[] ='del ';$buttons[] ='sub';$buttons[] ='sup';$buttons[] ='copy';$buttons[] ='paste';$buttons[] ='cut';$buttons[ ] ='image';$buttons[] ='anchor';$buttons[] ='backcolor';$buttons[] ='wp_page';$buttons[] ='charmap';return $buttons;}add_filter(" mce_buttons_2", "MBT_add_editor_buttons"); In the last line, the number 3 in mce_buttons_3 is the first few lines of our editor that we installed this line of plug-ins. Doesn’t it feel awesome? WordPress can customize software functions, that’s right , It is so powerful.
The setting is complete and there is no change. Remember to press this button and it will come out

进入WordPress后台,点击左侧的外观-编辑,然后右侧的 模板函数(functions.php)

也可以直接在ftp下或者某些可视化面板系统文件管理里直接编辑

在文档底部加入以下代码,点击更新文件。就可以看到编辑器里面多了一行。

其实这些就够我们用了,如果不满足,可以网上继续搜索一些字段,就是改变 $buttons[] = ‘改变我’; 就可以了。

 

最后一行的,mce_buttons_3 里面的数字3就是我们把这一行插件安装到我们编辑器的第几行,是不是感觉很牛逼,WordPress都可以自定义软件功能,没错,它就是这么强大。

 

设置完成 发现没有变化 记得按下这个按钮

这样就出来了 最终效果如下

参考jianshu.com/p/f901f6cfa368

 

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。