WordPress代码版:关注微信公众号回复可见和阅读更多的设置

Wordpress文章隐藏部分内容,设置关注微信公众号回复可见和阅读更多是一种吸粉方法,有需要的话可以试一试。后台微信公众号涨粉插件可以实现这一功能,如果你不想用插件的话,也可以使用类似短代码来完成。

一、fountions文件添加代码

//wordpress微信公众号吸粉的3种方法

function monseng_secret_content($atts, $content=null){
extract(shortcode_atts(array('key'=>null,'keyword'=>null), $atts));
if(isset($_POST['secret_key']) && $_POST['secret_key']==$key){
return '
'.$content.'
';
} else {
return
'
你的二维码名字
此处内容已经被作者无情的隐藏,请输入验证码查看内容
验证码:
请关注“你的名字”官方QQ公众号,回复关键字“'.$keyword.'”,获取验证码。【注】用手机QQ扫描右侧二维码都可以关注“你的名字”官方QQ公众号。
';
}
}
add_shortcode('gzh2v', 'monseng_secret_content');

// 后台文本编辑框中添加公众号隐藏简码按钮
function monseng_wpsites_add_gzh_quicktags() {
if (wp_script_is('quicktags')){
?> }
}
add_action( 'admin_print_footer_scripts', 'monseng_wpsites_add_gzh_quicktags' );

二、style.css 添加css代码

/*# sourceMappingURL=style.css.map */

.post_hide_box, .secret-password{background: none repeat scroll 0 0 #efe;border-left: 5px solid #e74c3c;color: #555;padding: 10px 0 10px 10px;border-radius: 5px;margin-bottom: 15px;overflow:hidden; clear:both;}
.post_hide_box .post-secret{font-size: 18px; line-height:20px; color:#e74c3c; margin:5px;}
.post_hide_box form{ margin:15px 0;}
.post_hide_box form span{ font-size:18px; font-weight:700;}
.post_hide_box .erweima{ margin-left:20px; margin-right:16px;}
.post_hide_box input[type=password]{ color: #9ba1a8; padding: 6px; background-color: #f6f6f6; border: 1px solid #e4e6e8; font-size: 12px;-moz-transition: border .25s linear,color .25s linear,background-color .25s linear; -webkit-transition: border .25s linear,color .25s linear,background-color .25s linear; -o-transition: border .25s linear,color .25s linear,background-color .25s linear; transition: border .25s linear,color .25s linear,background-color .25s linear;}
.post_hide_box input[type=submit] { background: #F88C00; border: none; border: 2px solid;border-color: #F88C00; border-left: none; border-top: none; padding: 0px;width: 100px; height: 38px; color: #fff; outline: 0;border-radius: 0 0 2px 0; font-size: 16px;}
.post_hide_box .details span{color:#e74c3c;}

三、发布文章时插入如下短代码

[gzh2v keyword="关键字" key="验证码"]隐藏内容[/gzh2v]

这样就完成了设置。

#现在前往

精选留言

WordPress,代码,关注,微信
sample
2020-11-17
写留言
签到
投稿
QQ咨询
返回顶部