WordPress文本编辑器添加自定义快捷标签按钮

WordPress文本编辑器添加自定义快捷标签按钮

将以下代码添加到你的WordPress主题的functions文件里:

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

《WordPress文本编辑器添加自定义快捷标签按钮》留言数:0

    发表留言