
使用方法
-
将以上代码放入主题的
functions.php
文件中。 -
将以上汉字部分修改成自己微信公众号的信息。
-
微信公众号的图片外链修改为自己的。
-
此代码在后台的>文章文本编辑器处,自动生成短代码按钮,不必手动输入短代码。
后台报错修正
解决涨粉代码导致的wordpress后台 Uncaught ReferenceError QTags is not defined 问题
检查 QuickTags 标签是否定义好
Examples
// add more buttons to the html editor function appthemes_add_quicktags() { if (wp_script_is('quicktags')){ ?> <script type="text/javascript"> QTags.addButton( 'eg_paragraph', 'p', '<p>', '</p>', 'p', 'Paragraph tag', 1 ); QTags.addButton( 'eg_hr', 'hr', '<hr />', '', 'h', 'Horizontal rule line', 201 ); QTags.addButton( 'eg_pre', 'pre', '<pre lang="php">', '</pre>', 'q', 'Preformatted text tag', 111 ); </script> <?php } } add_action( 'admin_print_footer_scripts', 'appthemes_add_quicktags' );
参考文档:https://codex.wordpress.org/Quicktags_API