一段代码搞定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)



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


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


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

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