分享互联网中的点点滴滴
本代码经过美化,你也可以自己美化
附件:所需图片.zip
附件内的图片全部上传到主题目录的img文件夹内,如您的主题图片文件夹名为images,可在css里修改

教程开始
1.首先载入美化的css

以本站dux为例,可以直接在后台>自定义代码添加css,其他模板可以自行添加模板文件里的style.css或是其他文件里,代码如下
提示框代码:

/**tishikuang**/
#sc_notice{color:#7da33c;background:#ecf2d6 url(../img/sc_notice.png) -1px -1px no-repeat;border:1px solid #aac66d;overflow:hidden;margin:10px 0;padding:15px 15px 15px 35px}
#sc_warn{color:#ad9948;background:#fff4b9 url(../img/sc_warn.png) -1px -1px no-repeat;border:1px solid #eac946;overflow:hidden;margin:10px 0;padding:15px 15px 15px 35px}
#sc_error{color:#c66;background:#ffecea url(../img/sc_error.png) -1px -1px no-repeat;border:1px solid #ebb1b1;overflow:hidden;margin:10px 0;padding:15px 15px 15px 35px}
#sc_tips{color:#777;background:#eaeaea url(../img/sc_tips.png) -1px -1px no-repeat;border:1px solid #ccc;overflow:hidden;margin:10px 0;padding:15px 15px 15px 35px}
#sc_blue{color:#4d99d2;background:#dbe7f8 url(../img/sc_blue.png) -1px -1px no-repeat;border:1px solid #4d99d2;overflow:hidden;margin:10px 0;padding:15px 15px 15px 35px}.sc_act{margin:10px 0;padding:10px 15px;background:#FFF;border:1px solid #e3e3e3;border-left:3px solid #3dabce}.sc_act:hover{background:#fcfcfc}
.tm-btn,
.button,
input[type="submit"]{color: #fff; background: #fd6639;color : #fff; background-image: none; background-color: #fd6639; color : #fff;padding: 0 25px; font-weight: bold; cursor: pointer; border: none; height: 36px; line-height: 36px; -webkit-border-radius: 2px; -moz-border-radius: 2px; -ms-border-radius: 2px; -o-border-radius: 2px; border-radius: 2px; -webkit-transition: all 0.2s ease-in-out 0s; -moz-transition: all 0.2s ease-in-out 0s; -o-transition: all 0.2s ease-in-out 0s; -ms-transition: all 0.2s ease-in-out 0s; transition: all 0.2s ease-in-out 0s; display: inline-block; margin: 5px;}
.tm-btn.small,
.button.small,
input[type="submit"].small{padding: 5px 10px; height: auto; line-height: 1.8;color: #fff;}

.tm-btn.green,
.button.green,
input[type="submit"].green{background: #7cc576;color : #fff;}

以上提供的是本站的一套美化方案,如果你有更好的,可以自己修改,上面的css也不仅仅有单单一个功能,可用于其他

2.打开主题目录的functions.php文件添加以下代码
 //部分内容输入密码可见
function e_secret($atts, $content=null){
extract(shortcode_atts(array('key'=>null), $atts));
if(isset($_POST['e_secret_key']) && $_POST['e_secret_key']==$key){
return '<div class="e-secret" id="sc_notice"><strong><span style="color: #ff6600;">隐藏内容:</span></strong><br> '.$content.'</div>';
}
else{
return '<div id="sc_warn"><form class="e-secret" action="'.get_permalink().'" method="post" name="e-secret">
<strong><span style="color: #ff6600;">此部分内容加密,请输入密码查看</span></strong><br><label>密码:</label><input type="password" name="e_secret_key" class="euc-y-i" maxlength="60">
<input type="submit" class="tm-bin green small" value="提取"><div class="euc-clear"></div> </form></div>';
}
}
add_shortcode('secret','e_secret');
3.文章编辑时引用
secret key="密码"】隐藏内容【/secret
将所有【 】换成[ ]
本站所有文章、图片、资源等如无特殊说明或标注,均为来自互联网或者站长原创,版权归原作者所有;仅作为个人学习、研究以及欣赏!如若本站内容侵犯了原著者的合法权益,可联系我们进行处理,邮箱:250048111@qq.com
赞(0) 打赏
标签:

上一篇:

下一篇:

相关推荐

如果你觉得这篇文章对你有帮助,请赞助一下我吧。

支付宝扫一扫打赏

微信扫一扫打赏