begin主题公众号获取密码查看隐藏内容
给WordPress博客begin主题添加关注微信公众号发验证码,公众号回复密码,这里只教WordPress这部份微信那边搞个关键词自回复即可。
教程:打开主题文件里的/inc/shortcode.php文件搜索加密内容删除加密内容到解压密码这些代码,再复制本文的代码粘贴到那个位置,添加完如下图。
代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
// 加密内容 function secret($atts, $content=null){ extract(shortcode_atts(array('key'=>null), $atts)); if ( current_user_can('level_10') ) { return '<p class="secret-password"><i class="be be-clipboard"></i>加密的内容:<br />'.do_shortcode( $content ).'</p>'; } if(isset($_POST['secret_key']) && $_POST['secret_key']==$key){ return '<p class="secret-password"><i class="be be-clipboard"></i>加密的内容:<br />'.do_shortcode( $content ).'</p>'; } else { return ' <form class="post-password-form" action="'.get_permalink().'" method="post"> <div class="post-secret"><i class="be be-info"></i>' . sprintf(__( '查看加密内容关注微信公众"XXXXX"回复:"'.get_the_ID().'"即可获密码, ', 'begin' )) . '<img class="alignright" src="https://www.mom1.cn/wp-content/uploads/2018/10/20181016120504mom1-cn33-e1540813266177.jpg" width="100" height="100" /></div> <p> <input id="pwbox" type="password" size="20" name="secret_key"> <input type="submit" value="' . sprintf(__( '提交', 'begin' )) . '" name="Submit"> </p> </form> '; } } |
共有 0 条评论