子比主题美化合集,本文章将持续更新,如需转载请备注转载地址:https://www.bfbke.com/2250.html
注:大部分文章收自互联网各个角落,无法溯源原作者,如有某个作者路过本站可私信或留言,已便备注转载声明。如有侵权请联系删帖。
添加文章精选
演示效果
1、将以下代码直接放到/wp-content/themes/zibll/inc/options/metabox-options.php
最下方:
文章更新或过期失效提示
演示效果
将下面的函数代码加入到主题根目录
下func.php
文件中。
//文章过期提示 毕方博客http://www.bfbke.com
function article_time_update() {
date_default_timezone_set('PRC');
$newdate=time();
$updated_date = get_the_modified_time('Y-m-d H:i:s');
$updatetime=strtotime($updated_date);
$custom_content = '';
if ( $newdate > $updatetime+86400) {
$custom_content= '<div class="article-timeout"><strong><i class="fa fa-bell" aria-hidden="true"></i> 温馨提示:</strong>本文最后更新于<code>'. $updated_date . '</code>,某些文章具有时效性,若有错误或已失效,请在下方<a href="#comment">留言</a>或联系<span id="contactContainer3"></span></div>';
}
echo $custom_content;
}
将下面的函数代码加入到/wp-content/themes/zibll/inc/functions/zib-single.php
中,约321行
article_time_update();//文章过期提示
CSS代码:(在自定义CSS样式添加下面代码)
顶部添加彩色进度条
CSS代码:
/*顶部进度条加载显示 毕方博客http://www.bfbke.com */
#percentageCounter{position:fixed; left:0; top:0; height:3px; z-index:99999; background-image: linear-gradient(to right, #339933,#FF6666);border-radius:5px;}
/*进度条加载显示*/
js代码:
html代码:
<div id="percentageCounter"></div>
文章加密
演示效果
文件/wp-content/themes/zibll/func.php
添加
/**
* WordPress 子比主题给文章内容添加密码开始
* 毕方博客http://www.bfbke.com
*/
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">'.$content.'</div>
';
}
else{return '<form class="post-password-form" action="'.get_permalink().'" method="post" name="e-secret">
<div class="mizhi_boy">
<div class="mz-bg">
<div class="mz-bg-d">
<div class="mz-main">
<span class="mz-ico">
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<rect data-fill="1" data-stroke="1" height="12" rx="1.5" stroke-linecap="round" stroke-linejoin="round"
width="14.67" x="5" y="10"></rect>
<path d="M7.667 10V6.667a4.667 4.667 0 1 1 9.333 0V10M12.333 14.667v2.666" data-stroke="1"
stroke-linecap="round" stroke-linejoin="round"></path>
</svg>
</span>
<label for="pwbox-142" style="color:#fff;">请输入密码查看加密内容</label>
<div class="relative line-form mb10 mizhi_w"><input type="password" name="e_secret_key" size="20" class="line-form-input" /></input><i class="line-form-line"></i><div class="scale-placeholder">文章密码</div></div>
<input type="submit" class="euc-y-s mz-button" value="确定" /></input>
<div id="contactContainers1"></div>
</div>
</div>
</div>
</div>
</form>';}
}
add_shortcode('secret','e_secret');
/**
* WordPress 子比主题给文章内容添加密码结束
*/
css:
使用方式
修改go外链跳转页面
演示效果
在主题目录下go.php文件里面的全部代码清空,然后把下面的代码复制进去即可。替换原来的即可。
更新主题和修改前记得备份go.php。
<?php
if (
strlen($_SERVER['REQUEST_URI']) > 384 ||
strpos($_SERVER['REQUEST_URI'], "eval(") ||
strpos($_SERVER['REQUEST_URI'], "base64")
) {
@header("HTTP/1.1 414 Request-URI Too Long");
@header("Status: 414 Request-URI Too Long");
@header("Connection: Close");
@exit;
}
//通过QUERY_STRING取得完整的传入数据,然后取得url=之后的所有值,兼容性更好
@session_start();
$t_url = !empty($_SESSION['GOLINK']) ? $_SESSION['GOLINK'] : preg_replace('/^url=(.*)$/i', '$1', $_SERVER["QUERY_STRING"]);
//数据处理
if (!empty($t_url)) {
//判断取值是否加密
if ($t_url == base64_encode(base64_decode($t_url))) {
$t_url = base64_decode($t_url);
}
//防止xss
$t_url = htmlspecialchars($t_url);
//对取值进行网址校验和判断
preg_match('/^(http|https|thunder|qqdl|ed2k|Flashget|qbrowser):\/\//i', $t_url, $matches);
if ($matches) {
$url = $t_url;
$title = '页面加载中,请稍候...';
} else {
preg_match('/\./i', $t_url, $matche);
if ($matche) {
$url = 'http://' . $t_url;
$title = '页面加载中,请稍候...';
} else {
$url = 'http://' . $_SERVER['HTTP_HOST'];
$title = '参数错误,正在返回首页...';
}
}
} else {
$title = '参数缺失,正在返回首页...';
$url = 'http://' . $_SERVER['HTTP_HOST'];
}
$url = str_replace('&', '&', $url);
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex, nofollow" />
<title><?php echo $title; ?></title>
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" />
<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<meta name="renderer" content="webkit"/>
<meta name="force-rendering" content="webkit"/>
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"/>
<link rel="shortcut icon" type="image/ico" href="/favicon.ico">
<script>
function link_jump()
{
//禁止其他网站使用我们的跳转页面
var MyHOST = new RegExp("<?php echo $_SERVER['HTTP_HOST']; ?>");
if (!MyHOST.test(document.referrer)) {
location.href="https://" + MyHOST;
}
location.href="<?php echo $url; ?>";
}
//延时1S跳转,可自行修改延时时间
//setTimeout(link_jump, 1500);
//延时50S关闭跳转页面,用于文件下载后不会关闭跳转页的问题
setTimeout(function(){window.opener=null;window.close();}, 50000);
</script>
<style>
*,:after,:before{box-sizing:border-box}body.reader-black-font,body.reader-black-font .history-mode .view-area,body.reader-black-font .history-mode .view-area pre,body.reader-black-font .main .kalamu-area,body.reader-black-font .main .markdown .text,body.reader-black-font input,body.reader-black-font select,body.reader-black-font textarea{font-family:-apple-system,SF UI Text,Arial,PingFang SC,Hiragino Sans GB,Microsoft YaHei,WenQuanYi Micro Hei,sans-serif}body{background:url();}.ext-link__wrapper{position:absolute;width:620px;padding:40px 0;border-radius:20px;text-align:center;top:118px;left:50%;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%);background-color:rgba(255, 255, 255, 0.5)!important;box-shadow:0 0 20px 0 #FFD1D8;overflow:hidden;background-image: url(https://cos.vs98k.cn/uploads/2024/06/12/22_open.4ea5f239.png),url(https://cos.vs98k.cn/uploads/2024/06/12/33_open.f7d7f655.png);background-position: 0 100%,100% 100%;background-repeat: no-repeat,no-repeat;background-size: 20%;}.title{font-size:22px;color:#2f2f2f;}.sub-title{font-size:16px;color:#888;margin-top:8px}.link-bd{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;width:460px;margin:12px auto 0;padding:10px;border-radius:50px;background:#ffebfb;border:1px solid #f5dcdc;zoom:1}.link-bd:after,.link-bd:before{content:" ";display:table}.link-bd .link-bd__icon{-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;display:flex;align-items:center;width:40px;justify-content:center;height:40px;line-height:40px;font-size:20px;text-align:center;border-radius:2px}.link-btn{text-align:center;font-size:0;margin-top:24px}.link-bd .link-bd__text{font-size:14px;color:#ff74b2;margin-left:10px;overflow:hidden;-o-text-overflow:ellipsis;text-overflow:ellipsis;white-space:nowrap}.link-btn__text{display:inline-block;width:144px;height:44px;line-height:43px;border-radius:22px;font-size:14px;color:#ff74b2;border:1px solid #ff74b2;cursor:pointer;text-decoration:none}.link-btn__text:hover{color:#fff;background:#ff74b2}
.alert-footer {
margin: 0 auto;
height: 90px;
padding:30px 60px;
display:inline-block;
}
.alert-footer-icon {
float: left;
padding:10px 10px;
text-align:right;
}
.alert-footer-text {
float: right;
border-left: 2px solid #EEE;
padding: 3px 0 0 5px;
height: 60px;
color: #0B85CC;
font-size: 12px;
text-align: left;
}
.alert-footer-text p {
color: #7A7A7A;
font-size: 22px;
line-height: 18px;
margin-top: 0px;
}
.ext-link__wrapper>img{
width:20%;
}
@media screen and (max-width: 768px){
.link-bd,.ext-link__wrapper{
width:90%;
}
.link-btn__text{
width:40%;
}
}
</style>
</head>
<body>
<div class="ext-link__wrapper">
<?php //echo zib_get_adaptive_theme_img(_pz('logo_src'), _pz('logo_src_dark')); ?><!--可修改成自己的LOGO-->
<div class="title">即将跳转到外部网站</div>
<div class="sub-title">跳转网站安全性未知,是否继续</div>
<div class="link-bd speedlist">
<div class="link-bd__icon"><svg t="1698155189995" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="13737" width="32" height="32"><path d="M398.45868 673.486553m-350.513448 0a350.513447 350.513447 0 1 0 701.026895 0 350.513447 350.513447 0 1 0-701.026895 0Z" fill="#FFD9D9" p-id="13738"></path><path d="M875.908068 100.146699m-100.146699 0a100.146699 100.146699 0 1 0 200.293399 0 100.146699 100.146699 0 1 0-200.293399 0Z" fill="#FFD9D9" p-id="13739"></path><path d="M875.908068 203.047433h-726.063569a12.518337 12.518337 0 0 1-12.518338-12.518338V80.86846a12.518337 12.518337 0 0 1 12.518338-12.518338h726.063569a12.518337 12.518337 0 0 1 12.518338 12.518338v109.660635a12.518337 12.518337 0 0 1-12.518338 12.518338z m-714.045965-25.036675h701.026895V93.386797h-701.026895zM398.45868 662.470416a75.110024 75.110024 0 0 1-51.57555-23.033741 61.59022 61.59022 0 0 1-9.764304-85.375061l108.408802-108.408802a12.518337 12.518337 0 0 1 17.776039 0 12.017604 12.017604 0 0 1 0 17.525672l-108.659168 108.659169c-10.76577 10.76577-6.259169 33.799511 10.01467 50.073349s39.057213 20.78044 50.073349 10.01467L544.672861 500.733496c10.76577-10.76577 6.259169-33.549144-10.01467-50.073349a12.518337 12.518337 0 0 1 17.776039-17.776039 61.59022 61.59022 0 0 1 9.764303 85.375061l-130.691443 130.941809a46.818582 46.818582 0 0 1-33.04841 13.269438z" fill="#2D2F33" p-id="13740"></path><path d="M507.368215 490.718826a12.267971 12.267971 0 0 1-8.762836-3.755501 61.339853 61.339853 0 0 1-10.01467-85.124694l130.941809-130.941809a61.339853 61.339853 0 0 1 85.124695 10.014669 61.59022 61.59022 0 0 1 10.01467 85.375062L606.012714 475.696822a12.518337 12.518337 0 0 1-17.776039 0 12.518337 12.518337 0 0 1 0-17.525673l108.659169-108.659169a25.036675 25.036675 0 0 0 5.508068-21.030806 54.830318 54.830318 0 0 0-15.272372-29.042543c-16.273839-16.023472-39.057213-20.530073-50.073349-9.764303l-130.691443 130.691442c-10.76577 11.016137-6.259169 33.799511 10.01467 50.07335a12.518337 12.518337 0 0 1 0 17.525672 12.768704 12.768704 0 0 1-9.013203 2.754034zM875.908068 853.500244h-726.063569a12.518337 12.518337 0 0 1-12.518338-12.518337v-109.660636a12.518337 12.518337 0 0 1 12.518338-12.518337h726.063569a12.518337 12.518337 0 0 1 12.518338 12.518337v109.660636a12.518337 12.518337 0 0 1-12.518338 12.518337z m-714.045965-25.036674h701.026895v-84.623961h-701.026895z" fill="#2D2F33" p-id="13741"></path></svg></div>
<div class="link-bd__text"><?php echo $url; ?></div>
</div>
<div class="link-btn">
<a href="javascript:void(0);" onclick="javascript:window.location.href='<?php echo $url; ?>'" class="link-btn__text">继续前往</a>
<a onclick="location.replace('//<?php echo $_SERVER['HTTP_HOST']; ?>')" class="link-btn__text" style="margin-left:10px;">回到主页</a>
</div>
</div>
</body>
</html>
侧边栏添加随机小姐姐
子比任意位置加入联系客服
Zibll子比主题美化-独立下载页面美化
演示效果
文件路径:/wp-content/themes/zibll/pages/download.php
记得备份!记得备份!记得备份!
JS代码(点击复制密码功能,单独的)
<!--下载页面密码复制-->
if(document.querySelectorAll(".but-download .badg")!=undefined){
const reg = /[a-zA-z0-9]/ig;
const copy = document.querySelectorAll(".but-download .badg");
for (let i = 0; i < copy.length; i++) {
copy[i].index = i;
copy[i].setAttribute("data-toggle", "tooltip");
copy[i].setAttribute("data-original-title", "点击复制");
copy[i].addEventListener("click", copyOperation);
};
function copyOperation() {
var oInput = document.createElement("input");
let text = this.innerText;
text = text.match(reg).join("");
oInput.value = text;
document.body.appendChild(oInput);
oInput.select();
document.execCommand("Copy");
oInput.className = "oInput";
oInput.style.display = "none";
this.setAttribute("data-original-title", "已复制");
};
};
最新发布文章列表角标
演示效果
PHP代码放置于funtions.php
或func.php
//新文章发布角标 毕方博客http://www.bfbke.com
function add_new_label_to_post_title($title, $id) {
if (!is_admin() && !is_single()) {
$post_time = get_the_time('U', $id);
if (time() - $post_time <= 24 * 60 * 60) {
$title .= ' <div class="tianyishangke-new-icon">NEW</div>';
}
}
return $title;
}
add_filter('the_title', 'add_new_label_to_post_title', 10, 2);
PHP代码放置于/wp-content/themes/zibll/inc/functions/zib-posts-list.php
518行 如图:
$sticky .= '<div class="tianyishangke-new-icon">精选</div>';
css代码放后台自定义代码
文章封面角标美化(可单独设置)
演示效果
一共三个文件,两个PHP文件代码和一个CSS文件代码,我会讲的很仔细,跟着教程操作
代码部分
/wp-content/themes/zibll/inc/options/metabox-options.php
进去文件之后,我们搜索关键词:“文章和页面seo
”,大约在848行,下面的代码放到关键词的上面,如下图
/wp-content/themes/zibll/inc/functions/zib-posts-list.php
样式文件
或者你引到php文件首页文章列表浮出
演示效果可见本站
,将下面代码添加到自定义CSS样式文件
或者你引到php文件
右上角悬挂年兽
演示效果
子比后台自定义html代码或者你引到php文件
<!--悬挂年兽-->
<div class="NewYear"></div>
CSS:自定义CSS样式文件
或者你引到php文件
美化弹窗公告
演示效果
增加仿mac三个点
演示效果
CSS:自定义CSS样式文件
或者你引到php文件
禁止网页调试
//判断是否是管理员
function check_if_user_is_admin() {
if (current_user_can('administrator')) {
echo "<script>var isUserAdmin = true;</script>";
} else {
echo "<script>var isUserAdmin = false;</script>";
}
}
add_action('wp_head', 'check_if_user_is_admin');
文章自定义文章动态前缀
演示效果
funtions.php
或func.php
样式文件
或者你引到php文件文章置顶美化
演示效果
子比友链检测及api接口
2024-08-06 10:28:51
,某些文章具有时效性,若有错误或已失效,请在下方留言或联系
- 最新
- 最热
只看作者