
代码效果
为WordPress的文本编辑器添加一些自定义按钮。这些按钮可以插入特定的短代码或HTML标签,从而方便用户在编辑器中快速插入常用的内容格式。
视频介绍
代码放置位置
子主题或父主题的functions.php中
代码查看
[content_hide]
add_action('after_wp_tiny_mce', 'bolo_after_wp_tiny_mce');
function bolo_after_wp_tiny_mce($mce_settings) {
?>
<script type="text/javascript">
QTags.addButton('custom_tag_1', '按钮 1【按钮名称】', '<div class="custom">', '</div>');
QTags.addButton('custom_tag_2', '按钮 2【按钮名称】', '<span class="highlight">', '</span>');
QTags.addButton('custom_tag_3', '按钮 3【按钮名称】', '<p class="note">', '</p>');
</script>
<?php
}[/content_hide]
