WordPress6.0 增加编辑器自定义按钮

Gavin Wu 2022年06月10日 7:06 Wordpress 984 Views

WordPress6.0 增加编辑器自定义按钮|微言心语
博客升级到了WordPress 6.0,经典编辑器之前自定义按钮不显示了,下面分享WordPress6.0 增加编辑器自定义按钮的方法。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//添加HTML编辑器自定义快捷标签按钮
add_action('after_wp_tiny_mce', 'add_button_mce');
function add_button_mce($mce_settings) {
?>
<script type="text/javascript">
    edButtons[110]=null;
    QTags.addButton( 'p', 'p', '<p style="text-indent: 2em;">', '</p>');
    QTags.addButton( 'h2', 'h2', '<h2>', '</h2>');
    QTags.addButton( 'h3', 'h3', '<h3>', '</h3>');
    QTags.addButton( 'h4', 'h4', '<h4>', '</h4>');
    QTags.addButton( 'h5', 'h5', '<h5>', '</h5>');

</script>
<?php
}

这里不多说,其他的可以根据自己写作习惯增加。

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

Top