导航
关闭

狼王King

当前位置:首页 > 网络教程 - 正文

WordPress怎么给后台编辑器添加按钮?

  人参与 |更新时间: 2020年02月12日 22:20

WordPress网站后台编辑器的按钮比较少,为了满足用户的需求,Wordpress是允许用户自己添加自定义按钮的。

WordPress怎么给后台编辑器添加按钮?

WordPress给后台编辑器添加按钮的方法也很简单。只需要在自己使用的Wordpress模板函数里添加以下的代码即可。

//添加HTML编辑器自定义快捷标签按钮
add_action('after_wp_tiny_mce', 'add_button_mce');
function add_button_mce($mce_settings) 
{?>
<script type="text/javascript">
QTags.addButton( 'hr', 'hr', "<hr />", "" );
QTags.addButton( 'h1', 'h1', "<h1>", "</h1>" );
QTags.addButton( 'h2', 'h2', "<h2>", "</h2>" );
QTags.addButton( 'h3', 'h3', "<h3>", "</h3>" );
</script>
<?php}

编辑:狼王(微信/QQ:1574808)

来源:狼王King(微信/QQ:1574808),欢迎分享!

本文链接:https://www.iwolfking.com/jiaocheng/815.html

评论专区

留言与评论(共有 0 条评论)
表情:   
验证码: