本文章只是个人无聊时的对子比主题美化记录集合,同时也是本人的备忘录。若您觉得可以的话就拿去贵站使用吧,我会不定期(主要是想不到好的美化了)更新一些美化教程、好玩的小工具、页面等等。
在 functions.php 文件中加入以下代码:
/*底部页脚开始*/
/*显示查询次数、查询时间及消耗内存底部页脚使用*/
function performance( $visible = true ) {
$stat = sprintf( '%d 次查询 | 用时 %.3f 秒 | 消耗 %.2fMB 内存',
get_num_queries(),
timer_stop( 0, 3 ),
memory_get_peak_usage() / 1024 / 1024
);
echo $visible ? $stat : "<!-- {$stat} -->" ;
}
/*
* @Project : 统计本周文章数量底部页脚使用
* @Author : Huliku
* @Url : huliku.com
* @LastEditTime : 2023-06-26 02:23:48
* @Email : ihuliku@qq.com
*/
function get_posts_count_from_last_168h($post_type ='post') {
global $wpdb;
$numposts = $wpdb->get_var(
$wpdb->prepare(
"SELECT COUNT(ID) ".
"FROM {$wpdb->posts} ".
"WHERE ".
"post_status='publish' ".
"AND post_type= %s ".
"AND post_date> %s",
$post_type, date('Y-m-d H:i:s', strtotime('-168 hours'))
)
);
return $numposts;
}
/*底部页脚*/
function get_site_domain() {
$url = get_site_url();
$domain = parse_url($url, PHP_URL_HOST);
// Remove 'www.' from the domain name
$domain = str_replace('www.', '', $domain);
return $domain;
}
/*底部页脚结束*/
- CSS代码和JS代码上传到网站根目录解压即可(调用默认根目录,亦可自行选择更换上传目录)。
- 部署路径:
/wp-content/themes/zibll/footer.php
先备份原文件,将下载的footer.php
代码直接覆盖即可。 - 把所有图片路径和链接修改成你自己的即可大功告成了!
在functions.php加上下面这段代码
//底部多功能导航开始
//获取评论数量
function zfunc_comments_users($postid=0,$which=0) {
$comments = get_comments('status=approve&type=comment&post_id='.$postid); //获取文章的所有评论
if ($comments) {
$i=0; $j=0; $commentusers=array();
foreach ($comments as $comment) {
++$i;
if ($i==1) { $commentusers[] = $comment->comment_author_email; ++$j; }
if ( !in_array($comment->comment_author_email, $commentusers) ) {
$commentusers[] = $comment->comment_author_email;
++$j;
}
}
$output = array($j,$i);
$which = ($which == 0) ? 0 : 1;
return $output[$which]; //返回评论人数
}
return 0; //没有评论返回0
};
// 随机文章
function random_posts(
$posts_num=5,$before='<li>',$after='</li>'){
global $wpdb;
$sql = "SELECT ID, post_title,guid
FROM $wpdb->posts
WHERE post_status = 'publish' ";
$sql .= "AND post_title != '' ";
$sql .= "AND post_password ='' ";
$sql .= "AND post_type = 'post' ";
$sql .= "ORDER BY RAND() LIMIT 0 , $posts_num ";
$randposts = $wpdb->get_results($sql);
$output = '';
foreach ($randposts as $randpost) {
$post_title = stripslashes($randpost->post_title);
$permalink = get_permalink($randpost->ID);
$output .= $before.'<a class="item-foot" href="'
. $permalink . '" rel="bookmark" data-toggle="tooltip" data-original-title="随机文章:';
$output .= $post_title . '"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-bianji"></use></svg><span id="wz">' . $post_title . '</span></a>';
$output .= $after;
}
echo '<div id="footgundong" class="wz"><ul>'.$output.'</ul></div>';
}
//弹窗提醒
function dorzs() {
echo '<script src="https://21lhz.cn/cdn/js/sweetalert.min.js"></script>';
echo '<script src="https://21lhz.cn/cdn/css/sweetalert.css"></script>';
echo '<script>$(document).on("click","#dorzs",function(){swal({title:"发工资啦",text:"哇!大恩超级开心的!!",icon:"/mh/img/dibu/yejiao/dashang.png",buttons:{weixin:{text:"微信",value:"weixin",},zfb:{text:"支付宝",value:"zfb",},dsmd:{text:"打赏名单",value:"dsmd",},},}).then(function(value){if(value=="weixin"){swal({title:"感谢打赏!",text:"感谢您的微信打赏,我会努力做得更好!",button:false,icon:"/mh/img/dibu/yejiao/wxzf.png"});}else if(value=="zfb"){swal({title:"感谢打赏!",text:"感谢您的支付宝打赏,我会努力做得更好!",button:false,icon:"/mh/img/dibu/yejiao/zfb.png"});}else if(value=="dsmd"){swal({title:"打赏名单",text:"【打赏名单未开放】",icon:"https://huliku.com/images/0dc4819f-400a-4ab0-b59b-ce114aa19a9e.png",button:false,});}});});</script>';
}
add_action( 'wp_footer', 'dorzs', 100 );
//点赞统计
function dz($post_id){
global $wpdb;
$sql = "SELECT SUM(`meta_value`) as num FROM `wp_postmeta` WHERE `meta_key`='like' AND `post_id`=$post_id";
$results = $wpdb->get_results($sql);
echo $results[0]->num;
}
//底部导航结束
引入阿里巴巴矢量库的图标,也可以自行修改
<!--阿里图标库-->
<script src="https://at.alicdn.com/t/font_2827587_k24if0ucns.js"></script>
<link rel="stylesheet" type="text/css" href="https://at.alicdn.com/t/font_2827587_k24if0ucns.css">
<style type="text/css">.icon {width: 1em; height: 1em;vertical-align: -0.15em;fill: currentColor;overflow: hidden;}</style>
在footer.php里加上下面代码
<!--底部导航-->
<style>
#footgundong{color: #666;margin-left:20px;overflow: overlay;display: inline-flex;text-align: right;}
.item-foot{color: #666;height: 45px;line-height: 45px;transition: color 0.35s;white-space: nowrap;}
.swal-footer{text-align:center;}
.swal-button {font-size: 20px;}
.count>svg,.count>text{display:none;}
.wz-span{border: 1px solid #999;height:auto;color:#999;font-size:10px;border-radius:2px;padding:0 2px;}
</style>
<div class="footwaveline">
<i style="background-image: url(/mh/img/dibu/yejiao/love.png);display: inline-block;width: 150px;height: 150px;position: fixed;bottom: -5px;z-index: 110;background-size: 100%;"></i>
<div class="footwavewave" style="background: url(/mh/img/dibu/yejiao/9855fd529028.png) 0 0 repeat-x;height: 3px;width: 100%;position: fixed;background-size: 10px 3px;z-index: 98;bottom: 40px;"></div>
<div id="shi" style="position: fixed;bottom: 0;margin-left: 200px;z-index: 99;">
<h4 class="my-face" style="font-size:13px;margin:0 5px 2px -50px;color:#797979;margin-bottom: 10px;">寒江孤影,江湖故人,相逢何必曾相识!</h4>
</div>
<div style="width: 100%;height: 40px;position: fixed;bottom: 0;z-index: 97;box-shadow: 0 -2px 10px rgb(0 0 0 / 10%);background:#fff;">
<nav class="joe_header__below-logon" style="float: right;margin-right: 50px;">
<?php if (is_home()) {
echo'<style>@media (max-width:1200px){#shi{display:none;}}.pl,.fx{display:none;}.dz{display:none !important;}</style>';
echo random_posts();
}elseif (is_page()) {
echo'<style>@media (max-width:1200px){#shi{display:none;}}.pl,.fx{display:none;}.dz{display:none !important;}</style>';
}
?>
<span style="margin-left:20px;" class="pl">
<a href="javascript:(scrollTo('#comments',-100));" data-toggle="tooltip" data-original-title="评论">
<svg class="icon" aria-hidden="true"><use xlink:href="#icon-pinglun"></use></svg><span style="color:#666;">评论(<count><?php echo zfunc_comments_users($post->ID); ?></count>)</span>
</a>
</span>
<span class="dz" style="margin-left:20px;display: inline-block;">
<a href="javascript:(scrollTo('#comments',-1000));" data-toggle="tooltip" data-original-title="点赞">
<svg class="icon" aria-hidden="true"><use xlink:href="#icon-dianzan"></use></svg><span style="color:#666;">点赞(<?php echo dz($post->ID)?>)</span>
</a>
</span>
<span style="margin-left:20px;line-height: 45px;" class="fx">
<a class="share-btn poster" poster-share="<?php the_ID();?>" title="海报分享" href="javascript:;">
<svg class="icon" aria-hidden="true"><use xlink:href="#icon-fenxiang"></use></svg><span style="color:#666;">分享</span>
</a>
</span>
<span style="margin-left:20px;line-height: 45px;" class="zs">
<a id="dorzs" data-toggle="tooltip" data-original-title="赞赏">
<svg class="icon" aria-hidden="true"><use xlink:href="#icon-qianbao"></use></svg><span style="color:#666;">赞赏</span>
</a>
</span>
<span style="margin-left:20px;line-height: 45px;" class="sc">
<a href="javascript:void(0);" id="shoucang" data-toggle="tooltip" data-original-title="收藏">
<svg class="icon" aria-hidden="true"><use xlink:href="#icon-xihuan"></use></svg><span style="color:#666;">收藏</span>
</a>
</span>
<a style="margin-left:20px; color:#666;" href="javascript:(scrollTo());" id="percentage" data-toggle="tooltip" data-original-title="返回顶部">
<svg class="icon" aria-hidden="true"><use xlink:href="#icon-dingwei"></use></svg>0%
</a>
</nav>
</div>
</div>
<?php dorzs();?>
<script>
var btn =document.getElementById("shoucang");
btn.onclick = function() {layer.msg('<p style="font-weight:700;margin:5px;">在键盘上按<span style="padding:5px 10px;background:#f0e7e2;border-radius:8px;color:#202020;margin:0 5px;">Ctrl</span>+<span style="padding:5px 10px;background:#f0e7e2;border-radius:8px;color:#202020;margin:0 5px;">D</span>即可<br>喜欢本站的话记得常来哦!</p>', function(){});};
</script>
<!--底部导航结束-->
css代码
/* 底部导航 start */
.my-face {
animation: my-face 5s infinite ease-in-out;
color: #00f1ff;
display: inline-block;
margin: 0 5px;
}
@-webkit-keyframes my-face {
2%, 24%, 80% {
-webkit-transform: translate(0, 1.5px) rotate(1.5deg);
transform: translate(0, 1.5px) rotate(1.5deg)
}
4%, 68%, 98% {
-webkit-transform: translate(0, -1.5px) rotate(-.5deg);
transform: translate(0, -1.5px) rotate(-.5deg)
}
38%, 6% {
-webkit-transform: translate(0, 1.5px) rotate(-1.5deg);
transform: translate(0, 1.5px) rotate(-1.5deg)
}
8%, 86% {
-webkit-transform: translate(0, -1.5px) rotate(-1.5deg);
transform: translate(0, -1.5px) rotate(-1.5deg)
}
10%, 72% {
-webkit-transform: translate(0, 2.5px) rotate(1.5deg);
transform: translate(0, 2.5px) rotate(1.5deg)
}
12%, 64%, 78%, 96% {
-webkit-transform: translate(0, -.5px) rotate(1.5deg);
transform: translate(0, -.5px) rotate(1.5deg)
}
14%, 54% {
-webkit-transform: translate(0, -1.5px) rotate(1.5deg);
transform: translate(0, -1.5px) rotate(1.5deg)
}
16% {
-webkit-transform: translate(0, -.5px) rotate(-1.5deg);
transform: translate(0, -.5px) rotate(-1.5deg)
}
18%, 22% {
-webkit-transform: translate(0, .5px) rotate(-1.5deg);
transform: translate(0, .5px) rotate(-1.5deg)
}
20%, 36%, 46% {
-webkit-transform: translate(0, -1.5px) rotate(2.5deg);
transform: translate(0, -1.5px) rotate(2.5deg)
}
26%, 50% {
-webkit-transform: translate(0, .5px) rotate(.5deg);
transform: translate(0, .5px) rotate(.5deg)
}
28% {
-webkit-transform: translate(0, .5px) rotate(1.5deg);
transform: translate(0, .5px) rotate(1.5deg)
}
30%, 40%, 62%, 76%, 88% {
-webkit-transform: translate(0, -.5px) rotate(2.5deg);
transform: translate(0, -.5px) rotate(2.5deg)
}
32%, 34%, 66% {
-webkit-transform: translate(0, 1.5px) rotate(-.5deg);
transform: translate(0, 1.5px) rotate(-.5deg)
}
42% {
-webkit-transform: translate(0, 2.5px) rotate(-1.5deg);
transform: translate(0, 2.5px) rotate(-1.5deg)
}
44%, 70% {
-webkit-transform: translate(0, 1.5px) rotate(.5deg);
transform: translate(0, 1.5px) rotate(.5deg)
}
48%, 74%, 82% {
-webkit-transform: translate(0, -.5px) rotate(.5deg);
transform: translate(0, -.5px) rotate(.5deg)
}
52%, 56%, 60% {
-webkit-transform: translate(0, 2.5px) rotate(2.5deg);
transform: translate(0, 2.5px) rotate(2.5deg)
}
58% {
-webkit-transform: translate(0, .5px) rotate(2.5deg);
transform: translate(0, .5px) rotate(2.5deg)
}
84% {
-webkit-transform: translate(0, 1.5px) rotate(2.5deg);
transform: translate(0, 1.5px) rotate(2.5deg)
}
90% {
-webkit-transform: translate(0, 2.5px) rotate(-.5deg);
transform: translate(0, 2.5px) rotate(-.5deg)
}
92% {
-webkit-transform: translate(0, .5px) rotate(-.5deg);
transform: translate(0, .5px) rotate(-.5deg)
}
94% {
-webkit-transform: translate(0, 2.5px) rotate(.5deg);
transform: translate(0, 2.5px) rotate(.5deg)
}
0%, 100% {
-webkit-transform: translate(0, 0) rotate(0);
transform: translate(0, 0) rotate(0)
}
}
@keyframes my-face {
2%, 24%, 80% {
-webkit-transform: translate(0, 1.5px) rotate(1.5deg);
transform: translate(0, 1.5px) rotate(1.5deg)
}
4%, 68%, 98% {
-webkit-transform: translate(0, -1.5px) rotate(-.5deg);
transform: translate(0, -1.5px) rotate(-.5deg)
}
38%, 6% {
-webkit-transform: translate(0, 1.5px) rotate(-1.5deg);
transform: translate(0, 1.5px) rotate(-1.5deg)
}
8%, 86% {
-webkit-transform: translate(0, -1.5px) rotate(-1.5deg);
transform: translate(0, -1.5px) rotate(-1.5deg)
}
10%, 72% {
-webkit-transform: translate(0, 2.5px) rotate(1.5deg);
transform: translate(0, 2.5px) rotate(1.5deg)
}
12%, 64%, 78%, 96% {
-webkit-transform: translate(0, -.5px) rotate(1.5deg);
transform: translate(0, -.5px) rotate(1.5deg)
}
14%, 54% {
-webkit-transform: translate(0, -1.5px) rotate(1.5deg);
transform: translate(0, -1.5px) rotate(1.5deg)
}
16% {
-webkit-transform: translate(0, -.5px) rotate(-1.5deg);
transform: translate(0, -.5px) rotate(-1.5deg)
}
18%, 22% {
-webkit-transform: translate(0, .5px) rotate(-1.5deg);
transform: translate(0, .5px) rotate(-1.5deg)
}
20%, 36%, 46% {
-webkit-transform: translate(0, -1.5px) rotate(2.5deg);
transform: translate(0, -1.5px) rotate(2.5deg)
}
26%, 50% {
-webkit-transform: translate(0, .5px) rotate(.5deg);
transform: translate(0, .5px) rotate(.5deg)
}
28% {
-webkit-transform: translate(0, .5px) rotate(1.5deg);
transform: translate(0, .5px) rotate(1.5deg)
}
30%, 40%, 62%, 76%, 88% {
-webkit-transform: translate(0, -.5px) rotate(2.5deg);
transform: translate(0, -.5px) rotate(2.5deg)
}
32%, 34%, 66% {
-webkit-transform: translate(0, 1.5px) rotate(-.5deg);
transform: translate(0, 1.5px) rotate(-.5deg)
}
42% {
-webkit-transform: translate(0, 2.5px) rotate(-1.5deg);
transform: translate(0, 2.5px) rotate(-1.5deg)
}
44%, 70% {
-webkit-transform: translate(0, 1.5px) rotate(.5deg);
transform: translate(0, 1.5px) rotate(.5deg)
}
48%, 74%, 82% {
-webkit-transform: translate(0, -.5px) rotate(.5deg);
transform: translate(0, -.5px) rotate(.5deg)
}
52%, 56%, 60% {
-webkit-transform: translate(0, 2.5px) rotate(2.5deg);
transform: translate(0, 2.5px) rotate(2.5deg)
}
58% {
-webkit-transform: translate(0, .5px) rotate(2.5deg);
transform: translate(0, .5px) rotate(2.5deg)
}
84% {
-webkit-transform: translate(0, 1.5px) rotate(2.5deg);
transform: translate(0, 1.5px) rotate(2.5deg)
}
90% {
-webkit-transform: translate(0, 2.5px) rotate(-.5deg);
transform: translate(0, 2.5px) rotate(-.5deg)
}
92% {
-webkit-transform: translate(0, .5px) rotate(-.5deg);
transform: translate(0, .5px) rotate(-.5deg)
}
94% {
-webkit-transform: translate(0, 2.5px) rotate(.5deg);
transform: translate(0, 2.5px) rotate(.5deg)
}
0%, 100% {
-webkit-transform: translate(0, 0) rotate(0);
transform: translate(0, 0) rotate(0)
}
}
/* end */
@media (max-width: 800px){.footwaveline{display: none;}}
.wz-color span{
cursor: pointer;
}
/*底部导航*/
JS代码
<!--底部导航滚动进度条百分比-->
$(function(){var $this=$("#footgundong");var scrollTimer;$this.hover(function(){clearInterval(scrollTimer)},function(){scrollTimer=setInterval(function(){scrollNews($this)},2000)}).trigger("mouseleave");function scrollNews(obj){var $self=obj.find("ul");var lineHeight=$self.find("li:first").height();$self.animate({"marginTop":-lineHeight+"px"},500,function(){$self.css({marginTop:0}).find("li:first").appendTo($self)})}})
window.onscroll = function() {
let scrollNow = window.pageYOffset;
let pageClientHeight = document.documentElement.clientHeight;
let scrollHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight, document.body.clientHeight, document.documentElement.clientHeight) - pageClientHeight;
let fullWindowHeightInPercentage = Math.round((scrollNow / scrollHeight) * 100);
let percentage = document.getElementById('percentage');
percentage.innerHTML = '<svg class="icon" aria-hidden="true"><use xlink:href="#icon-dingwei"></use></svg> ' + fullWindowHeightInPercentage + '%';
if (fullWindowHeightInPercentage == 0) percentage.innerHTML = '<svg class="icon" aria-hidden="true"><use xlink:href="#icon-dingwei"></use></svg> 到顶啦';
if (fullWindowHeightInPercentage == 100) percentage.innerHTML = '<svg class="icon" aria-hidden="true"><use xlink:href="#icon-jiasu1"></use></svg> 到底啦';
}
在主题目录—>footer.php的“<footer class….>”上方加入以下代码:
<!--底部可爱底线提示-->
<div style="position: relative;text-align: center;"><img decoding="async" src="/mh/img/dibu/yejiao/77b402473c122354.png">
<p style="position: absolute;top: 30%;left: 50%;margin-left: -40px;font-size: 10px;">你已经到达了世界的尽头</p>
</div>
只需在后台—>外观—>小工具—>自定义HTML添加下面的代码,把它放在合适的位置(本站放在侧边栏),然后就可以啦。
<style type="text/css">
#container-box-1{color:#526372;text-transform:uppercase;width:100%;font-size:16px;line-height:50px;text-align:center;padding: 10px;background: linear-gradient(45deg, #C7F5FE 10%, #C7F5FE 40%, #FCC8F8 40%, #FCC8F8 60%, #EAB4F8 60%, #EAB4F8 65%, #F3F798 65%, #F3F798 90%);border-radius: var(--main-radius);}
#flip-box-1{overflow:hidden;height:50px;border-radius:99px}
#flip-box-1 div{height:50px}
#flip-box-1>div>div{color:#fff;display:inline-block;text-align:center;height:50px;width:100%}
#flip-box-1 div:first-child{animation:show 8s linear infinite}
.flip-box-1-1{background-image:linear-gradient(to right,#fa709a 0,#fee140 100%)}
.flip-box-1-2{background-image: linear-gradient(120deg, #e0c3fc 0%, #8ec5fc 100%);}
.flip-box-1-3{background-image: linear-gradient(to right, #b8cbb8 0%, #b8cbb8 0%, #b465da 0%, #cf6cc9 33%, #ee609c 66%, #ee609c 100%);}
.flip-box-1-4{background-image: linear-gradient(to right, #f78ca0 0%, #f9748f 19%, #fd868c 60%, #fe9a8b 100%);}
.flip-box-1-5{background-image: linear-gradient(to right, #74ebd5 0%, #9face6 100%);}
.flip-box-1-6{background-image: linear-gradient(to top, #9795f0 0%, #fbc8d4 100%);}
@keyframes show{0%{margin-top:-300px}
5%{margin-top:-250px}
16.666%{margin-top:-250px}
21.666%{margin-top:-200px}
33.332%{margin-top:-200px}
38.332%{margin-top:-150px}
49.998%{margin-top:-150px}
54.998%{margin-top:-100px}
66.664%{margin-top:-100px}
71.664%{margin-top:-50px}
83.33%{margin-top:-50px}
88.33%{margin-top:0}
99.996%{margin-top:0}
100%{margin-top:300px}
}
</style>
<div id="container-box-1">
<div class="container-box-1-1"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-xiangwenbiaoqing"></use></svg> 坚持每天来逛逛,会让你 <svg class="icon" aria-hidden="true"><use xlink:href="#icon-aini"></use></svg></div>
<div id="flip-box-1"><div><div class="flip-box-1-1">生活也美好了!</div>
</div><div><div class="flip-box-1-2">心情也舒畅了!</div></div>
<div><div class="flip-box-1-3">走路也有劲了!</div></div><div>
<div class="flip-box-1-4">腿也不痛了!</div></div>
<div><div class="flip-box-1-5">腰也不酸了!</div></div>
<div><div class="flip-box-1-6">工作也轻松了!</div></div>
</div><div class="container-box-1-2"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-aini"></use></svg> 你好我也好,不要忘记哦! <svg class="icon" aria-hidden="true"><use xlink:href="#icon-xiangwenbiaoqing"></use></svg></div></div>
1.在子比主题的主题目录下,header.php底部添加以下函数代码:
<!--调用信息代码-->
<!--底部统计用的代码-->
<script type="text/javascript" >
<?php
//用户总数
$users = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->users");echo "var tj_jstext="."'$users'";
?>
</script>
<script type="text/javascript" >
<?php
/*
* WordPress获取今日发布文章数量
*/
function nd_get_24h_post_count(){
$today = getdate();
$query = new WP_Query( 'year=' . $today["year"] . '&monthnum=' . $today["mon"] . '&day=' . $today["mday"]);
$postsNumber = $query->found_posts;
return $postsNumber;
}
$post_24h = nd_get_24h_post_count();
echo "var tj_24h="."'$post_24h'";
?>
</script>
<script type="text/javascript" >
<?php
/*
* WordPress整站文章访问计数
*/
function nd_get_all_view(){
global $wpdb;
$count=0;
$views= $wpdb->get_results("SELECT * FROM $wpdb->postmeta WHERE meta_key='views'");
foreach($views as $key=>$value){
$meta_value=$value->meta_value;
if($meta_value!=' '){
$count+=(int)$meta_value;
}
}return $count;
}
$post_view = nd_get_all_view();
echo "var tj_view="."'$post_view'";
?>
</script>
<script type="text/javascript" >
<?php
//日志总数
$count_posts = wp_count_posts();
$published_posts =$count_posts->publish;
echo "var tj_rzzs="."'$published_posts'";
?>
</script>
<script type="text/javascript" >
<?php
//稳定运行
$wdyx_time = floor((time()-strtotime("2024-04-21"))/86400);
echo "var tj_wdyx="."'$wdyx_time'";
?>
</script>
<!--调用信息代码结束-->
注:函数运行日期2022-01-06改为你自己网站运行的日期。
2.在后台–>外观–>小工具–>自定义HTML,把自定义HTML放到合适的版块里(子比主题放在首页-底部全宽度),然后把下面代码复制粘贴进去,即可在前台显示。
<!--信息统计开始-->
<div id="nuandao" style="box-shadow: 0 0 10px var(--main-shadow);">
<div class="siteCount">
<div class="wrapper">
<div class="p-wh">
<ul>
<li>
<p><svg class="icon fa-2x" aria-hidden="true"><use xlink:href="#icon-xiaolian-"></use></svg></p>
<span><script type="text/javascript" >
document.write(tj_jstext);
</script></span>
<p>网友总数</p>
</li>
<li>
<p><svg class="icon fa-2x" aria-hidden="true"><use xlink:href="#icon-wenzhang"></use></svg></p>
<span><script type="text/javascript" >
document.write(tj_rzzs);
</script></span>
<p>文章总数</p>
</li>
<li>
<p><svg class="icon fa-2x" aria-hidden="true"><use xlink:href="#icon-liulan"></use></svg></p>
<span><script type="text/javascript" >
document.write(tj_view);
</script></span>
<p>浏览总数</p>
</li>
<li>
<p><svg class="icon fa-2x" aria-hidden="true"><use xlink:href="#icon-fabusekuai"></use></svg></p>
<span></span>
<span><script type="text/javascript" >
document.write(tj_24h);
</script></span>
<p>今日发布</p>
</li>
<li>
<p><svg class="icon fa-2x" aria-hidden="true"><use xlink:href="#icon-shijian"></use></svg></p>
<span><script type="text/javascript" >
document.write(tj_wdyx);
</script></span>
<p>稳定运行</p>
</li>
</ul>
</div>
<div class="join">
<p style="text-align:center">欢迎光临DaenGAME-专注单机游戏试玩及正版推荐!<br><br>By:Daen</p>
</div>
</div>
</div>
</div>
<style type="text/css">
/*背景图*/#nuandao .siteCount{position: relative; padding: 60px 0; background: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3)),url(https://www.daenyx.com/mh/img/dibu/2.png) center center / cover no-repeat fixed;/*border-radius:8px;*/border-radius: var(--main-radius);}#nuandao .siteCount .cover{height: 100%; width: 100%; background: rgba(0, 0, 0, 0.3); position: absolute; top: 0; left: 0;}
/*内容*/#nuandao .siteCount .wrapper{position: relative; z-index: 10; width: 100%; max-width: 100%; margin: 0 auto;}#nuandao .siteCount ul{display: flex;}#nuandao .siteCount ul li{width: 20%; color: #fff; text-align: center;}
/*模块*/#nuandao .siteCount ul li span{font-size: 48px; font-family: Arial;}@media screen and (max-width: 768px){#nuandao .siteCount ul li span{font-size: 20px; font-family: Arial;}}#nuandao .p-wh{font-weight:700;}
/*底部文本p标签*/.join{padding-top: 20px;font-size: 15px;color: #FFF;letter-spacing: 0.5px;font-weight: 600;}
@media screen and (max-width: 768px){#nuandao .siteCount{position: relative; padding: 30px 0;border-radius:8px;}#nuandao .siteCount .cover{height: 100%; width: 100%; background: rgba(0, 0, 0, 0.3); position: absolute; top: 0; left: 0;}}
</style>
<script>
//document.getElementById("nuandao").parentNode.parentNode.style.backgroundColor="transparent"
document.getElementById("nuandao").parentNode.parentNode.style.padding=0
</script>
<!--信息统计结束-->
一、PHP代码:
需要配合美化5第一项
二、HTML+JS代码
下面是HTML+js代码,至于放在哪,【外观】【小工具】【自定义HTML】【首页底部全宽度】,不想多说了。
<div id="wiiuii-info-wg-mian">
<div class="wiiuii-info-item">
<div class="wiiuii-yxsj-item">
<svg class="icon fa-2x" aria-hidden="true">
<use xlink:href="#icon-xiuxiyixia"></use>
</svg>
<span class="wiiuii-i-num"
><script type="text/javascript">
document.write(tj_wdyx);
</script></span
>
<p>运行时间</p>
</div>
<div class="wiiuii-yhzs-item">
<svg class="icon fa-2x" aria-hidden="true">
<use xlink:href="#icon-zhanghuguanli"></use>
</svg>
<span class="wiiuii-i-num"
><script type="text/javascript">
document.write(tj_jstext);
</script></span
>
<p>用户总数</p>
</div>
<div class="wiiuii-llzs-item">
<svg class="icon fa-2x" aria-hidden="true">
<use xlink:href="#icon-yanjing"></use>
</svg>
<span class="wiiuii-i-num"
><script type="text/javascript">
document.write(tj_view);
</script></span
>
<p>浏览总数</p>
</div>
<div class="wiiuii-wz-item">
<div class="wiiuii-wz-sty wiiuii-wzzs-item">
<svg class="icon fa-2x" aria-hidden="true">
<use xlink:href="#icon-xiezuoye"></use>
</svg>
<span class="wiiuii-i-num"
><script type="text/javascript">
document.write(tj_rzzs);
</script></span
>
<p>文章总数</p>
</div>
<div class="wiiuii-wz-sty wiiuii-jrfb-item">
<svg class="icon fa-2x" aria-hidden="true">
<use xlink:href="#icon-aixin"></use>
</svg>
<span class="wiiuii-i-num"
><script type="text/javascript">
document.write(tj_24h);
</script></span
>
<p>今日发布</p>
</div>
</div>
<div class="wiiuii-sjcs-item">
<div class="wiiuii-sjcj-m">
<span style="font-size: 30px">今日</span>
<div id="wiiuii-date-text"></div>
<div id="wiiuii-week-text"></div>
<div class="wiiuii-meo-item">
<img id="wiiuii-meos" src="/mh/img/dibu/emo/expression-1.png" alt="emo" />
</div>
<div class="wiiuii-sjcj-content">
<span id="wiiuii-fatalism"></span>
</div>
</div>
</div>
</div>
</div>
<script>
$(function () {
var myDate = new Date();
var year = myDate.getFullYear(); //获取当前年
var mon = myDate.getMonth() + 1; //获取当前月
var date = myDate.getDate(); //获取当前日
var week = myDate.getDay();
var weeks = [
"星期日",
"星期一",
"星期二",
"星期三",
"星期四",
"星期五",
"星期六"
];
$("#wiiuii-date-text").html(year + "年" + mon + "月" + date + "日");
$("#wiiuii-week-text").html(weeks[week]);
if (week > 0 && week < 5) {
$("#wiiuii-fatalism").html("再坚持" + (5 - week) + "天就到周末啦!");
} else if (week === 5) {
$("#wiiuii-fatalism").html("啊啊啊,明天就是周末啦!");
} else {
$("#wiiuii-fatalism").html("今天是周末,好好休息一下吧!");
}
$("#wiiuii-meos").attr(
"src","/mh/img/dibu/emo/expression-" + week + ".png"
);
});
$("#wiiuii-info-wg-mian").parents(".zib-widget").css({
padding: "0",
background: "none"
});
</script>
三、CSS代码
下面是CSS代码,原本一起放的,但是CSS Grid布局不兼容WP的自定义工具,所以就只能放在主题后台的【自定义CSS样式】里面咯!
CSS样式一
.wiiuii-info-item{display:grid;grid-gap:15px;grid-template-columns:repeat(5,1fr);grid-template-rows:repeat(2,1fr);width:100%;height:280px}
.wiiuii-llzs-item,.wiiuii-sjcs-item,.wiiuii-yhzs-item,.wiiuii-yxsj-item{width:100%;height:100%;border-radius:8px;text-align:center;box-shadow:0 2px 4px 0 rgba(0,0%,0%,5%);background-color:var(--main-bg-color);overflow:hidden;padding:5px;box-sizing:border-box}
.wiiuii-i-num{font-size:30px;font-weight:700}
.wiiuii-yxsj-item{display:flex;align-items:center;justify-content:center;flex-direction:column}
.wiiuii-yhzs-item{display:flex;align-items:center;justify-content:center;flex-direction:column}
.wiiuii-llzs-item{display:flex;align-items:center;justify-content:center;flex-direction:column}
.wiiuii-wz-item{display:grid;grid-gap:20px;grid-template-columns:repeat(2,1fr);grid-column:1/4;grid-row:1/2;overflow:unset!important;box-shadow:none!important;padding:0!important}
.wiiuii-wz-sty{width:100%;height:100%;border-radius:8px;display:flex;align-items:center;justify-content:center;flex-direction:column;background-color:var(--main-bg-color);box-shadow:0 2px 4px 0 rgba(0,0%,0%,5%)}
.wiiuii-sjcs-item{grid-row:1/3;grid-column:4/6}
.wiiuii-sjcj-m{position:relative;font-size:20px;font-weight:700;text-align:left;width:100%;height:100%;padding:10px;box-sizing:border-box}
.wiiuii-sjcj-content{text-align:center;margin-top:10px}
.wiiuii-meo-item{width:100px;height:100px;margin:0 auto}
.wiiuii-meo-item>img{width:100%;height:100%;background-size:cover;background-repeat:no-repeat;background-position:center center;cursor:pointer}
@media screen and (max-width:959px){.wiiuii-info-item{grid-gap:10px;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(4,1fr);height:500px}
.wiiuii-sjcs-item{grid-row:3/5;grid-column:1/4}
.wiiuii-i-num{font-size:20px}
.wiiuii-sjcj-m{font-size:16px}
}
CSS样式二
.wiiuii-info-item{display:grid;grid-gap:15px;grid-template-columns:repeat(5,1fr);grid-template-rows:repeat(2,1fr);width:100%;height:280px}
.wiiuii-llzs-item,.wiiuii-sjcs-item,.wiiuii-yhzs-item,.wiiuii-yxsj-item{width:100%;height:100%;border-radius:8px;text-align:center;box-shadow:0 2px 4px 0 rgba(0,0%,0%,5%);-webkit-backdrop-filter:saturate(5) blur(20px);backdrop-filter:saturate(5) blur(20px);overflow:hidden;padding:5px;box-sizing:border-box}
.wiiuii-i-num{font-size:30px;font-weight:700}
.wiiuii-yxsj-item{display:flex;align-items:center;justify-content:center;flex-direction:column}
.wiiuii-yhzs-item{display:flex;align-items:center;justify-content:center;flex-direction:column}
.wiiuii-llzs-item{display:flex;align-items:center;justify-content:center;flex-direction:column}
.wiiuii-wz-item{display:grid;grid-gap:20px;grid-template-columns:repeat(2,1fr);grid-column:1/4;grid-row:1/2;overflow:unset!important;box-shadow:none!important;padding:0!important}
.wiiuii-wz-sty{width:100%;height:100%;border-radius:8px;display:flex;align-items:center;justify-content:center;flex-direction:column;-webkit-backdrop-filter:saturate(5) blur(20px);backdrop-filter:saturate(5) blur(20px);box-shadow:0 2px 4px 0 rgba(0,0%,0%,5%)}
.wiiuii-sjcs-item{position:relative;grid-row:1/3;grid-column:4/6}
.wiiuii-sjcj-m{position:relative;font-size:20px;font-weight:700;text-align:left;width:100%;height:100%;padding:10px;box-sizing:border-box}
.wiiuii-sjcj-content{text-align:center;margin-top:10px;position:absolute;bottom:0;right:0}
.wiiuii-meo-item{width:140px;height:140px;margin:0 auto;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}
.wiiuii-meo-item>img{width:100%;height:100%;background-size:cover;background-repeat:no-repeat;background-position:center center;cursor:pointer}
@media screen and (max-width:959px){.wiiuii-info-item{grid-gap:10px;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(4,1fr);height:500px}
.wiiuii-sjcs-item{grid-row:3/5;grid-column:1/4}
.wiiuii-i-num{font-size:20px}
.wiiuii-sjcj-m{font-size:16px}
}
五、效果图如下
CSS样式1效果:
CSS样式2效果:
CSS代码
/* logo扫光 */
.navbar-brand{position:relative;overflow:hidden;margin: 0px 0 0 0px;}.navbar-brand:before{content:""; position: absolute; left: -665px; top: -460px; width: 200px; height: 15px; background-color: rgba(255,255,255,.5); -webkit-transform: rotate(-45deg); -moz-transform: rotate(-45deg); -ms-transform: rotate(-45deg); -o-transform: rotate(-45deg); transform: rotate(-45deg); -webkit-animation: searchLights 6s ease-in 0s infinite; -o-animation: searchLights 6s ease-in 0s infinite; animation: searchLights 6s ease-in 0s infinite;}@-moz-keyframes searchLights{50%{left: -100px; top: 0;} 65%{left: 120px; top: 100px;}}@keyframes searchLights{40%{left: -100px; top: 0;} 60%{left: 120px; top: 100px;} 80%{left: -100px; top: 0px;}}
CSS代码
/*导航栏字体加粗*/
ul.nav {font-weight: 700;}
使用教程
- 在后台主题设置—>自定义代码—>自定义javascript代码把下面的代码添加到里面即可实现。
//动态标题
var OriginTitile = document.title,
titleTime;
document.addEventListener("visibilitychange",
function() {
if (document.hidden) {
document.title = "你别走吖 Σ(っ °Д °;)っ";
clearTimeout(titleTime)
} else {
document.title = "(/≧▽≦/)你可算回来啦! " ;
titleTime = setTimeout(function() {
document.title = OriginTitile
},
2000)
}
});
效果图
CSS代码:(本站的样式)
/** 鼠标样式 开始**/
/** 普通指针样式**/
body{cursor: url(/mh/img/quanzhan/x3.cur), default;}
/** 链接指针样式**/
a:hover{cursor:url(/mh/img/quanzhan/x4.cur), pointer;}
/** 鼠标样式 结束**/
在主题设置—>文章&列表—>文章页—>版权提示内容处添加以下代码:
<div class="box">
<b class="lurenfen">
<p>① 本网站的文章内容来源于网络,学习研究后请自觉删除,请勿传播,因未及时删除所造成的任何后果责任自负。</p>
<p>② 若您认为「WWW.DAENZY.COM」发布的内容若侵犯到您的权益,请联系站长邮箱:5585397@qq.com 进行删除处理。</p>
③ 本站资源大多存储在云盘,如发现链接失效,请联系我们,我们会第一时间更新。
</b>
</div>
<style type="text/css">
.box {
position: relative;
padding: 10px;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
border-radius: 20px;
}
.box:before {
content: '';
position: absolute;
width: 150%;
height: 50%;
background: linear-gradient(315deg, #00ccff, #d400d4);
animation: animate 6s linear infinite
}
@keyframes animate {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.box:after {
content: '';
position: absolute;
inset: 6px;
background: var(--body-bg-color);
border-radius: 15px;
z-index: 2;
}
.lurenfen {
position: relative;
font-weight: normal;
color: #2997f7;
z-index: 4;
margin: 15px;
}
</style>
效果图
二.美化版版权说明
最近觉得自己的版权说明不好看,可能是视觉疲劳吧,看多了就觉得不好看,就研究一下美化,现在共享出来!(放到后台的文章页->版权提示内容里保存就行了)
<div style="margin-top:20px;">
<legend align="center" style="width: 40%;margin: 0 auto -14px auto;border-radius: 999px;background: #777777;color: #fff;">版权声明</legend>
<div class="joe_div">
<div class="item">
<svg t="1626845917242" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4434" width="16" height="16"><path d="M737.41824 413.42976c0-74.9312-54.784-135.68-122.368-135.68s-122.368 60.74368-122.368 135.68 54.784 135.68 122.368 135.68 122.368-60.75392 122.368-135.68z m205.44512 433.97632c0-59.5968-144.27136-121.78432-328.48896-121.78432s-333.55776 66.81088-333.55776 126.40768S430.15168 913.6896 614.4 913.6896s328.46336-6.69184 328.46336-66.28864z" fill="#F4CA1C" p-id="4435"></path><path d="M516.6592 606.08c-134.25664 0-243.47648-119.86432-243.47648-267.19744S382.40256 71.68 516.6592 71.68s243.47648 119.86432 243.47648 267.20256-109.22496 267.19744-243.47648 267.19744z m0-471.28064c-99.5328 0-180.51072 91.55072-180.51072 204.0832s80.97792 204.07808 180.51072 204.07808 180.51072-91.5456 180.51072-204.07808-80.97792-204.0832-180.51072-204.0832zM517.7088 957.44C278.3744 957.44 71.68 957.44 71.68 841.728c0-108.71808 208.42496-204.0832 446.0288-204.0832 111.75936 0 219.136 19.57888 302.32576 55.13216C908.64128 730.624 957.44 781.312 957.44 835.40992 957.44 948.4544 766.85824 957.44 517.7088 957.44z m0-256.68096c-233.88672 0-383.05792 92.55936-383.05792 140.96384 0 17.57696 34.42176 32.65024 94.4384 41.344 71.79776 10.40896 173.18912 11.264 288.62464 11.264 104.09472 0 210.6368-1.73056 284.72832-14.28992 58.49088-9.91744 92.032-26.17856 92.032-44.6208-0.01024-47.48288-143.04768-134.66112-376.76544-134.66112z" fill="#595BB3" p-id="4436"></path></svg>
<span>本站网络名称:</span>
<span style="color: #3333ff"><span style="color: #FF6666; font-size: 18px"><strong style="color: #777777;">DaenGAME</strong></span></span>
</div>
<div class="item">
<svg t="1626845985384" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4698" width="16" height="16"><path d="M493.12768 371.93216a158.45376 158.45376 0 1 0-158.45376 157.79328 158.12096 158.12096 0 0 0 158.45376-157.79328z m419.8656 345.97376a158.45376 158.45376 0 1 0-158.45376 157.79328 158.12096 158.12096 0 0 0 158.45376-157.79328z" fill="#F4CA1C" p-id="4699"></path><path d="M757.87776 447.93344V205.89568l157.33248 151.552a36.90496 36.90496 0 1 0 51.4048-52.96128l-193.98144-186.88a79.41632 79.41632 0 0 0-110.80192 1.09056l-131.02592 131.33312a246.272 246.272 0 1 0-273.96096 329.33376v79.46752H83.05664a36.864 36.864 0 1 0 0 73.6768h173.78816v160.256a36.97664 36.97664 0 0 0 73.95328 0v-160.256h152.064a246.40512 246.40512 0 1 0 275.01568-284.57472zM128.04608 337.73056a172.544 172.544 0 1 1 172.544 171.91424 172.42624 172.42624 0 0 1-172.544-171.91424z m353.5104 321.1008H330.79808v-77.42464a246.2208 246.2208 0 0 0 216.30464-243.2l136.82176-137.11872v248.32a246.48704 246.48704 0 0 0-202.368 209.42336z m244.2752 204.45184a171.90912 171.90912 0 1 1 172.544-171.90912 172.42624 172.42624 0 0 1-172.544 171.90912z" fill="#595BB3" p-id="4700"></path></svg>
<span>本站永久网址:</span>
<font color="#FF6666" style="color: #777777;font-weight: 600;">https://a.daenzy.com</font>
</div>
<div class="item">
<svg t="1626845999833" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4830" width="16" height="16"><path d="M964.30592 749.2352a215.07072 215.07072 0 1 0-215.07072 215.07072 215.07072 215.07072 0 0 0 215.07072-215.07072z" fill="#F4CA1C" p-id="4831"></path><path d="M488.40192 655.24736a77.96224 77.96224 0 0 1-50.53952-18.432l-104.27904-88.35584A35.328 35.328 0 0 1 379.22816 494.592l104.27392 88.3456a7.74144 7.74144 0 0 0 10.80832-0.81408l179.93216-206.21312a35.328 35.328 0 0 1 53.20704 46.41792l-179.92192 206.208a78.25408 78.25408 0 0 1-59.12576 26.71104zM514.56 952.32a437.76 437.76 0 1 1 437.76-437.76 438.272 438.272 0 0 1-437.76 437.76z m0-804.91008a367.1552 367.1552 0 1 0 367.1552 367.15008 367.56992 367.56992 0 0 0-367.1552-367.15008z" fill="#595BB3" p-id="4832"></path></svg>
<span>网站侵权说明:</span>
<span class="text" style="">本网站的文章部分内容可能来源于网络,仅供大家学习与参考,如有侵权,请联系站长QQ5917254删除处理。<br>
<span class="btn-info btn-xs pink">1</span> 本站一切资源不代表本站立场,并不代表本站赞同其观点和对其真实性负责。<br>
<span class="btn-info btn-xs pink">2</span> 本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报<br>
<span class="btn-info btn-xs pink">3</span> 本站资源大多存储在云盘,如发现链接失效,请联系我们我们会第一时间更新。
</span>
</div>
</div>
</div>
CSS代码
/*文章页版权说明*/
.pink{background-color:#777777 !important;}
@media screen and (min-width: 680px){.joe_div{background: url(/mh/img/wenzhang/1.png) right 10px bottom 10px no-repeat;background-size: 12%;}}
.joe_div{color:#989898;word-break: break-all;line-height: 25px;border-radius: 10px;border: 1px solid #777777;padding: 28px 14px 14px 14px;}
效果图
1.在主题目录下创建widget-websitestat.php文件,然后把下面的php代码添加进去。
<?php
// WordPress统计信息小工具
// 名称: 网站信息统计
// 由星语一人独立修改并美化
// 修改版-美化版V1.0
// 定义小工具的类 EfanWebsitestat
class EfanWebsitestat extends WP_Widget{
function __construct(){
// 定义小工具的构造函数
$widget_ops = array('classname' => 'widget_Websitestat', 'description' => '显示网站的统计信息');
parent::__construct(false, 'WIIUII 网站统计', $widget_ops);
}
function form($instance){
// 表单函数,控制后台显示
// $instance 为之前保存过的数据
// 如果之前没有数据的话,设置默认量
$instance = wp_parse_args(
(array)$instance,
array(
'title' => '网站信息统计',
'establish_time' => '2024-04-21'
)
);
$title = htmlspecialchars($instance['title']);
$establish_time = htmlspecialchars($instance['establish_time']);
// 表格布局输出表单
$output = '<table>';
$output .= '<tr><td>标题</td><td>';
$output .= '<input id="'.$this->get_field_id('title') .'" name="'.$this->get_field_name('title').'" type="text" value="'.$instance['title'].'" />';
$output .= '</td></tr><tr><td>建站时间:</td><td>';
$output .= '<input id="'.$this->get_field_id('establish_time') .'" name="'.$this->get_field_name('establish_time').'" type="text" value="'.$instance['establish_time'].'" />';
$output .= '</td></tr></table>';
echo $output;
}
function update($new_instance, $old_instance){
// 更新数据的函数
$instance = $old_instance;
// 数据处理
$instance['title'] = strip_tags(stripslashes($new_instance['title']));
$instance['establish_time'] = strip_tags(stripslashes($new_instance['establish_time']));
return $instance;
}
function widget($args, $instance){
extract($args); //展开数组
$title = apply_filters('widget_title',empty($instance['title']) ? ' ' : $instance['title']);
$establish_time = empty($instance['establish_time']) ? '2021-01-01' : $instance['establish_time'];
echo $before_widget;
echo $before_title . $title . $after_title;
echo '<div class="widgest-boys"><ul>';
$this->efan_get_websitestat($establish_time);
echo '</ul></div>';
echo $after_widget;
}
function efan_get_websitestat($establish_time){
// 相关数据的获取
global $wpdb;
$count_posts = wp_count_posts();
$published_posts = $count_posts->publish;
$comments_count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments");
$time = floor((time()-strtotime($establish_time))/86400);
$count_tags = wp_count_terms('post_tag');
$count_pages = wp_count_posts('page');
$link = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->links WHERE link_visible = 'Y'");
$users = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->users");
$last = $wpdb->get_results("SELECT MAX(post_modified) AS MAX_m FROM $wpdb->posts WHERE (post_type = 'post' OR post_type = 'page') AND (post_status = 'publish' OR post_status = 'private')");
$last = date('Y-m-d', strtotime($last[0]->MAX_m));
$total_views = $wpdb->get_var("SELECT SUM(meta_value+0) FROM $wpdb->postmeta WHERE meta_key = 'views'");
// 显示数据
$output = '<div class="widgest-bg widgest-bg1"><div class="widgest-main"><div class="widgest-meat"><li>文章总数:';
$output .= $published_posts;
$output .= ' 篇</li></div></div></div>';
$output .= '<div class="widgest-bg widgest-bg2"><div class="widgest-main"><div class="widgest-meat"><li>评论数目:';
$output .= $comments_count;
$output .= ' 条</li></div></div></div>';
$output .= '<div class="widgest-bg widgest-bg3"><div class="widgest-main"><div class="widgest-meat"><li>标签总数:';
$output .= $count_tags;
$output .= ' 个</li></div></div></div>';
$output .= '<div class="widgest-bg widgest-bg4"><div class="widgest-main"><div class="widgest-meat"><li>浏览次数:';
$output .= $total_views;
$output .= ' 次</li></div></div></div>';
$output .= '<div class="widgest-bg widgest-bg5"><div class="widgest-main"><div class="widgest-meat"><li>友链总数:';
$output .= $link;
$output .= ' 个</li></div></div></div>';
$output .= '<div class="widgest-bg widgest-bg6"><div class="widgest-main"><div class="widgest-meat"><li>用户总数:';
$output .= $users;
$output .= ' 个</li></div></div></div>';
$output .= '<div class="widgest-bg widgest-bg7"><div class="widgest-main"><div class="widgest-meat"><li>运行天数:';
$output .= $time;
$output .= ' 天</li></div></div></div>';
$output .= '<div class="widgest-bg widgest-bg8"><div class="widgest-main"><div class="widgest-meat"><li>建站时间:';
$output .= $establish_time;
$output .= '</li></div></div></div>';
$output .= '<div class="widgest-bg widgest-bg9"><div class="widgest-main"><div class="widgest-meat"><li>最后更新:';
$output .= $last;
$output .= '</li></div></div></div>';
// 页面生成耗时+数据库查询
$output .= '<div class="widgest-bg widgest-bg10"><div class="widgest-main"><div class="widgest-meat"><li>数据查询:';
$output .= get_num_queries();
$output .= ' 次 </li></div></div></div>';
$output .= '<div class="widgest-bg widgest-bg11"><div class="widgest-main"><div class="widgest-meat"><li>生成耗时:';
$output .= timer_stop(0,5);
$output .= '秒</li></div></div></div>';
echo $output;
}
}
function EfanWebsitestat(){
// 注册小工具
register_widget('EfanWebsitestat');
}
add_action('widgets_init','EfanWebsitestat');
?>
2、在主题目录下functions.php文件,添加下面的函数代码即可。
//添加站点统计小工具
include("widget-websitestat.php");
3、在网站后台—》主题设置—》自定义代码—》自定义CSS样式,添加下面的CSS代码,主题没有自定义CSS样式的,在主题目录下style.css添加即可。
/*统计小模块*/
.widget_Websitestat h3{font-weight:700;}.widgest-boys{overflow:hidden;}.widgest-boys .widgest-bg{margin: 4px; background-size: cover; background-repeat: no-repeat; background-position: center center; cursor: pointer; border-radius: 8px;}.widgest-boys .widgest-main{align-items: center; place-content: flex-start space-around; display: flex;}.widgest-boys .widgest-meat{display: block; margin-block-start: 1em; margin-block-end: 1em; margin-inline-start: 0px; margin-inline-end: 0px; color: rgb(255, 255, 255); font-weight: 700 !important; line-height: 1.5 !important;}.widgest-bg:not(article){transition: all 0.3s;}.widgest-bg:not(article):hover{transform: translateX(-10px);}
/*图片路径设置*/
.widgest-bg1{background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)),url(/mh/img/cebianlan/cetongji/1.jpg);}
.widgest-bg2{background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)),url(/mh/img/cebianlan/cetongji/2.jpg);}
.widgest-bg3{background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)),url(/mh/img/cebianlan/cetongji/3.jpg);}
.widgest-bg4{background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)),url(/mh/img/cebianlan/cetongji/4.jpg);}
.widgest-bg5{background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)),url(/mh/img/cebianlan/cetongji/5.jpg);}
.widgest-bg6{background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)),url(/mh/img/cebianlan/cetongji/6.jpg);}
.widgest-bg7{background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)),url(/mh/img/cebianlan/cetongji/7.jpg);}
.widgest-bg8{background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)),url(/mh/img/cebianlan/cetongji/8.jpg);}
.widgest-bg9{background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)),url(/mh/img/cebianlan/cetongji/9.jpg);}
.widgest-bg10{background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)),url(/mh/img/cebianlan/cetongji/10.jpg);}
.widgest-bg11{background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)),url(/mh/img/cebianlan/cetongji/11.jpg);}
- 说明(非常重要):图片我是通过一张图片剪切成11张图片(有11个信息统计),然后通过CSS添加进去的。你可以自己剪切11张图片,然后按顺序添加进去,css中”widgest-bg1-widgest-bg11″都是按顺序好的,在url(图片链接路径)里面加,不懂的找留言或者联系我。
- 我用的剪切工具是在百度乱找的,呐!http://www.zuohaotu.com/cut-image.aspx就是这个。
- 剪切教程:
4、最后一步,在网站后台—》外观—》小工具—》WIIUII 网站统计,添加到侧边栏即可完成。
- 标题和建站时间自己填写。
效果图
将下面的函数代码加入到主题目录下functions.php文件中。
//文章过期提示
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>或点击<a target="_blank" title="反馈" href="/problem"><b>反馈</b></a>。</div >';
}
echo $custom_content;
}
在主题目录zibll/inc/functions/zib-single.php文件中,文章分页函数(大概是320-321行,因为我的代码有改动,所有不确定行数,见下图)下面添加下方代码即可。
article_time_update();//文章过期提示
CSS代码:(在自定义CSS样式添加下面代码)
/*过期文章提示样式*/
.article-timeout{position:relative; border-radius: 8px; position: relative; margin-bottom: 25px; padding: 10px; background-color: var(--body-bg-color);}
效果图
在主题设置—》自定义CSS样式,添加下面的CSS代码:
/*评论背景图*/
textarea#comment {background-color:transparent;background:linear-gradient(rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05)),url(/mh/img/wenzhang/pinglu.png) right 10px bottom 10px no-repeat;-moz-transition:ease-in-out 0.45s;-webkit-transition:ease-in-out 0.45s;-o-transition:ease-in-out 0.45s;-ms-transition:ease-in-out 0.45s;transition:ease-in-out 0.45s;}
textarea#comment:focus {background-position-y:789px;-moz-transition:ease-in-out 0.45s;-webkit-transition:ease-in-out 0.45s;-o-transition:ease-in-out 0.45s;-ms-transition:ease-in-out 0.45s;transition:ease-in-out 0.45s;}
效果图
CSS代码
/**首页背景美化**/
body {
background-image: url("/mh/img/zhuti/1694106092-bg.webp");
background-position-x: center;
background-position-y: center;
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
}
HTML代码:
<style type="text/css">
#update_version img{margin:0px 0 15px }#update_version a{width:30%;height:35px;border-radius:3px;text-align:center;line-height:35px;font-size:9pt;color:#fff;font-weight: 700;}.blog_link{background-color:#2ba9fa}.blog_link,.cms_link{float:left;margin-right:5%}.cms_link{background-color:#ff6969}.grid_link{float:left;background-color:#70c041}
</style>
<div id="update_version">
<a href="https://mail.qq.com/cgi-bin/qm_share?t=qm_mailme&email=5585397@qq.com" target="_blank" rel="noopener"><img title="DaenGAME" src="/mh/img/cebianlan/tougao.gif" alt="图片" style="border-radius:5px;" /></a>
<a class="blog_link" href="https://mail.qq.com/cgi-bin/qm_share?t=qm_mailme&email=5585397@qq.com" target="_blank" style="background-image: linear-gradient(to right, #99CCCC, #FFCC99)" rel="noopener">发送邮件</a>
<a class="cms_link" href="https://www.daenyx.com/index.php/newposts/" target="_blank" style="background-image: linear-gradient(to right, #FF9999,#996699)" rel="noopener">点击投稿</a>
<a class="grid_link" href="https://www.daenyx.com/about" target="_blank" style="background-image: linear-gradient(to right,#339933, #9933CC)" rel="noopener">关于我们</a>
</div>
<div>
<hr>
<a href="https://www.daenyx.com/index.php/newposts/" target="_blank" rel="noopener">点击在线投稿</a>
<br>
投稿邮箱:<b>5585397@qq.com</b>
<br>
交流 QQ:<b><a href="https://a.daenzy.com" target="_blank" rel="noopener">5585397</a></b>
</div>
效果图
首页-底部全宽度,自定义HTML添加下面代码即可。
<div id="wiiuii" style="box-shadow: 0 0 10px var(--main-shadow);">
<section class="buy-container">
<div class="buy-box">
<div class="slogan">
<h3>DaenGAME</h3>
<p>欢迎光临寒舍!</p>
</div>
<ul class="actions">
<li>
<a href="http://wpa.qq.com/msgrd?v=3&uin=5585397&site=qq&menu=yes" target="_blank" class="buy-button primary" rel="noopener noreferrer">联系站长</a>
</li>
<li>
<a href="https://a.daenzy.com/links" target="_blank" class="demo-button" rel="noopener noreferrer">友链通道</a>
</li>
</ul>
</div>
<span class="tips"><div id="go-fav">更多精彩文章,按<span>Ctrl</span>+<span>D</span>收藏本站!</div></span>
</section>
</div>
<style type="text/css">
.buy-container{color: #ccc; padding: 60px 40px 50px 40px;margin: 0 auto; background: rgb(224,32,140); /*下述两行代码为兼容浏览器用,建议同步修改,亦可删除(不建议)*/background: -moz-linear-gradient(left, rgb(160,32,240) 0%, rgb(0,191,255) 100%);background: -webkit-linear-gradient(left, rgb(160,32,240) 0%,rgb(0,191,255) 100%); /*请更改此行代码,颜色为rgb模式*/background: linear-gradient(to right, rgb(160,32,240) 0%, rgb(0,191,255) 100%);filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e0208c', endColorstr='#fa6400',GradientType=1 );/*-webkit-border-radius: 8px;-moz-border-radius: 8px;-o-border-radius: 8px;border-radius: 8px;*/border-radius: var(--main-radius);}.buy-container .buy-box{display: -webkit-box; display: flex; -webkit-box-pack: justify; justify-content: space-between; -webkit-box-align: center; align-items: center; max-width: 900px; margin: 0 auto;}@media screen and (max-width: 700px){.buy-container .buy-box{display: block; text-align: center;}.buy-container .buy-box .slogan{margin-bottom: 30px;}}.buy-container .buy-box .slogan h3{color: #fff;font-size: 26px;margin: 0 0 10px 0;}@media screen and (max-width: 800px){.buy-container .buy-box .slogan h3{font-size: 24px;}}@media screen and (max-width: 500px){.buy-container .buy-box .slogan h3{font-size: 20px;}}@media screen and (max-width: 400px){.buy-container .buy-box .slogan h3{font-size: 18px;}}.buy-container .buy-box .slogan p{color: #fff;font-size: 14px;font-weight: bold;margin: 10px 0;}.buy-container .buy-box .actions{display: -webkit-box; display: flex; -webkit-box-align: center; align-items: center;list-style-type: none;margin: 0;padding: 0;}@media screen and (max-width: 700px){.buy-container .buy-box .actions{-webkit-box-pack: justify; justify-content: center;}}.buy-container .buy-box .actions li{margin: 0;}.buy-container .buy-box .actions li:last-child{margin-left: 10px;}.buy-container .buy-box .actions li a{position: relative;color: #fff !important;font-size: 14px;font-weight: bold; line-height: 1;text-decoration: none;padding: 10px 20px;background-color: rgba(255, 255, 255, .1);-webkit-border-radius: 4px;-moz-border-radius: 4px;-o-border-radius: 4px;border-radius: 4px;-webkit-transition: .2s;-moz-transition: .2s;-o-transition: .2s;transition: .2s;}.buy-container .buy-box .actions li a:hover{-webkit-transform: translateY(-2px);-moz-transform: translateY(-2px);-o-transform: translateY(-2px);transform: translateY(-2px); -webkit-box-shadow: 0 5px 10px 0 rgba(0, 0, 0, .2); -moz-box-shadow: 0 5px 10px 0 rgba(0, 0, 0, .2); -o-box-shadow: 0 5px 10px 0 rgba(0, 0, 0, .2); box-shadow: 0 5px 10px 0 rgba(0, 0, 0, .2);opacity: 1 !important;}@media screen and (max-width: 330px){.buy-container .buy-box .actions li a{font-size: 12px;}}.buy-container .buy-box .actions li a:not(.primary):before{content: "";position: absolute;top: 0;left: 0;width: 100%;height: 100%;-webkit-box-shadow: inset 0 0 0 1px currentColor;-moz-box-shadow: inset 0 0 0 1px currentColor;-o-box-shadow: inset 0 0 0 1px currentColor;box-shadow: inset 0 0 0 1px currentColor;-webkit-border-radius: 4px;-moz-border-radius: 4px;-o-border-radius: 4px;border-radius: 4px;-khtml-opacity: .3;-moz-opacity: .3;opacity: .3;}.buy-container .buy-box .actions li a:after{display: none;}.buy-container .buy-box .actions li a.primary{color: #ff3b30 !important;background-color: #fff;}.buy-container .tips{border-top: 1px solid rgba(255, 255, 255, .1);display: block;color: #fff;font-size: 12px;text-align: center; max-width: 900px;margin: 30px auto 0 auto;padding-top: 30px;}@media screen and (max-width: 768px){.buy-container {padding: 30px 40px 30px 40px;}}#go-fav{width:100%; height:100%; line-height:30px; text-align:center; font-size:14px; font-weight:700; color:rgba(255, 255, 255, 1);}#go-fav span{padding:5px 10px; background:#f0e7e2; border-radius:8px; color:#202020; margin:0 5px;}
</style>
<script>
document.getElementById("wiiuii").parentNode.parentNode.style.padding=0;
</script>
效果图
第二款
<div class="widget-graphic-cover mb20 hidden-xs"><div style="--font-size:30px;"><div class="graphic hover-zoom-img noshadow mb10 " style="padding-bottom: 16%!important;"><video autoplay="" loop="" muted="" class="fit-cover lazyloading" data-src="/mh/img/dibu/1.mp4" src="/mh/img/dibu/1.mp4" poster="/mh/img/dibu/slider-bg.webp"></video><div class="abs-center text-center graphic-text this-font"><div class="em12 mb10 font-bold">专心做好一件事</div>
打造更好的DaenGAME</div></div></div></div>
1、后台添加[自定义HTML小工具]
这里就不在说如何添加自定义HTML小工具了,把它添加到侧边,然后把下面的代码放进去,然后保存就好啦!【如果报错无法保存,请把style标签里的CSS样式放到主题设置的“自定义CSS样式”里就可以了】
<style type="text/css">
.wiiuii-suiji-main span{color:#fff}.wiiuii-suiji-main{background-size:cover;background-repeat:no-repeat;background-position:center center;cursor:pointer;height:320px;border-radius:var(--main-radius);position:relative}.wiiuii-suiji-header{display:flex;justify-content:space-between}.xingyu-dt-ty{padding:20px;display:flex;flex-direction:column}.xingyu-dt-day{font-size:60px;font-weight:700;color:#fff}.xingyu-sj-date{font-size:16px;font-weight:700;color:#fff}.xingyu-sjzt-ty{line-height:25px;height:200px;writing-mode:vertical-rl;padding:15px;color:#fff;font-size:15px}.xingyu-sj-qhbtn{position:absolute;bottom:30px;padding:10px}.xingyu-sj-qhbtn>span>i{font-size:16px}.xingyu-sj-qhbtn span:hover{color:#f44336}.xingyu-sjtitle-ty{position:absolute;bottom:0;text-align:center;left:0;right:0;bottom:0;padding:5px}
</style>
<div class="wiiuii-suiji-main">
<div class="wiiuii-suiji-header">
<div class="xingyu-dt-ty">
<span class="xingyu-dt-day wiiuiiDay"></span>
<p class="xingyu-sj-date">
<span class="wiiuiiYear"></span>
<span class="wiiuiiMonth"></span>
</p>
</div>
<div class="xingyu-sjzt-ty">
<span class="xingyu-yiyin"></span>
</div>
</div>
<div class="xingyu-sj-qhbtn">
<span id="xingyu-qh-btn"
><i class="fa fa-paper-plane" aria-hidden="true"></i> 换一句</span
>
</div>
<div class="xingyu-sjtitle-ty">
<span>——更多游戏,上DaenGAME——</span>
</div>
</div>
<script
type="text/javascript"
src="/mh/img/cebianlan/shiju/yiyin-img.js"
></script>
2、关于JS文件
如果大家不觉得麻烦的话,可以自己修改背景图和一言,JS代码放到下面,自己创建一个JS文件然后复制进去,自己修改后调用。如果觉得麻烦可以自己用本站的就好。
[重要]:一言修改或者添加在“wiiuiiYiYan”这里面,背景图修改或者添加在“wiiuiiYiYanBg”里面。
/**
*
*本代码有星语(wiiuii.cn)独立完成!
*
*/
var wiiuiiYiYan = [
'休对故人思故国,且将新火试新茶。诗酒趁年华。——宋苏轼《望江南》',
'山中何事?松花酿酒,春水煎茶。——元张可久《人月圆》',
'最是人间留不住,朱颜辞镜花辞树。——清·王国维《蝶恋花》',
'正是江南好风景,落花时节又逢君。——唐·杜甫《江南逢李龟年》',
'醉后不知天在水,满船清梦压星河。——元·唐温如《题龙阳县青草湖》',
'纸屏石枕竹方床,手倦抛书午梦长。——宋蔡确《夏日登车盖亭》',
'曾是惊鸿照影来。——宋陆游《沈园二首》',
'人生天地间,忽如远行客。——汉佚名《古诗十九首》',
'直道相思了无益,未妨惆怅是清狂。——唐·李商隐《无题》',
'秋风生渭水,落叶满长安。——唐·贾岛《忆江上吴处士》',
'一愿郎君千岁,二愿妾身常健。——唐冯延巳《长命女》',
'雾失楼台,月迷津渡。桃源望断无寻处。——宋秦观《踏莎行郴州旅舍》',
'独立小楼风满袖,平林新月人归后。——南唐冯延巳《鹊踏枝》',
'晓看天色暮看云,行也思君,坐也思君。——明唐寅《一剪梅》',
'叹息老来交旧尽,睡来谁共午瓯茶。——宋陆游《幽居初夏》',
'客散酒醒深夜后,更持红烛赏残花。——唐李商隐《花下醉》',
'柴门闻犬吠,风雪夜归人。——唐·刘长卿《逢雪宿芙蓉山主人》',
'庭院深深深几许,杨柳堆烟,帘幕无重数。——宋欧阳修《蝶恋花》',
'有约不来过夜半,闲敲棋子落灯花。——宋赵师秀《约客》',
'满目山河空念远,落花风雨更伤春。不如怜取眼前人。——宋晏殊《浣溪沙》'
]
var wiiuiiYiYanBg = [
'https://www.daenyx.com/mh/img/cebianlan/shiju/12.png',
'https://www.daenyx.com/mh/img/cebianlan/shiju/13.png',
'https://www.daenyx.com/mh/img/cebianlan/shiju/14.png',
'https://www.daenyx.com/mh/img/cebianlan/shiju/15.png',
'https://www.daenyx.com/mh/img/cebianlan/shiju/16.png',
'https://www.daenyx.com/mh/img/cebianlan/shiju/6.png',
'https://www.daenyx.com/mh/img/cebianlan/shiju/7.png',
'https://www.daenyx.com/mh/img/cebianlan/shiju/8.png',
'https://www.daenyx.com/mh/img/cebianlan/shiju/9.png',
'https://www.daenyx.com/mh/img/cebianlan/shiju/10.png',
'https://www.daenyx.com/mh/img/cebianlan/shiju/11.png'
]
var wiiuiiYiMain = document.querySelector(".wiiuii-suiji-main"),
wiuiSjMain = wiiuiiYiMain.parentNode.parentNode,
date = new Date,
wiiuiiMonth = date.getMonth() + 1,
wiiuiiDay = date.getDate();
document.querySelector(".wiiuiiYear").innerHTML = date.getFullYear() + "年";
10 > wiiuiiMonth ? document.querySelector(".wiiuiiMonth").innerHTML = "0" + wiiuiiMonth + "月" : document.querySelector(".wiiuiiMonth").innerHTML = wiiuiiMonth + "月";
10 > wiiuiiMonth && (document.querySelector(".wiiuiiDay").innerHTML = "0" + wiiuiiDay);
wiuiSjMain.style.padding = "0";
var wiiuiiYyRanBtn = document.querySelector("#xingyu-qh-btn"),
wiiuiiYiYinTextBox = document.querySelector(".xingyu-yiyin");
function wiiuiiRanYiYin() {
var a = Math.floor(Math.random() * wiiuiiYiYanBg.length);
wiiuiiYiYinTextBox.innerHTML = wiiuiiYiYan[Math.floor(Math.random() * wiiuiiYiYan.length)];
wiiuiiYiMain.style.backgroundImage = "url(" + wiiuiiYiYanBg[a] + ")";
console.log("\n %c DaenGAME - http://a.daenzy.com", "color:#fff; background: linear-gradient(55deg, #212121 0%, #212121 40%, #323232 calc(40% + 1px), #323232 60%, #008F95 calc(60% + 1px), #008F95 70%, #14FFEC calc(70% + 1px), #14FFEC 100%);padding:5px; border-radius: 5px;")
}
wiiuiiRanYiYin();
wiiuiiYyRanBtn.onclick = function() {
wiiuiiRanYiYin()
};
wiiuiiYiYinTextBox.onclick = function() {
var a = document.querySelector(".xingyu-yiyin").textContent.split("。")[0];
open("https://so.gushiwen.cn/search.aspx?value=" + a)
};
壹、上传文件和目录
- 在文章末尾资源下载处下载文件,解压后把json目录上传到网站的根目录下,json目录中有两个文件是追剧页面的,我还没弄样式,后期我会发,如果介意请自行删除。
- 把bilibili-bangumi.php文件上传到子比主题目录zibll/pages目录下。
- 上传后文件中出现中文的乱码,可能ZIP对中文兼容性不是太好,请自行创建文件,然后复制代码进去即可。
贰、修改文件
1、bilibiliAcconut.php文件
- 登陆B站,进入个人空间,获取UID(如下图)
F12进入控制台(进入后需要刷新一遍)获取B站Cookie(如下图)
在bilibiliAcconut.php文件中添加获取来的UID和Cookie(如下图)。
叁、创建页面
在网站后台—>页面—>新建页面—>页面属性–模板–B站追番页面(古腾堡编辑器是这样的,不知道经典编辑器是不是一样),然后发布页面即可。
代码:(一些说明请仔细看)
- CSS代码:(放在哪,这里就不在说了,自己可以压缩一下CSS代码)
/*下载样式*/
.download-article{
padding: 0 10px;
}
.download-demo{
margin: 10px 0;
border: 1px dashed red;
border-radius: 5px;
}
.download-wiui{
padding: 5px;
display: flex;
justify-content: center;
align-items: center;
}
.download-sty{
text-align: center;
height: 100%;
}
.download-sty p{
font-size: 15px !important;
text-align: center;
margin: 0;
}
.download-sty img{
width: 140px;
height: 100%;
}
.download-theme-box{
margin-bottom: 20px;
display: inline-flex;
flex-direction: row;
align-items: center;
}
.download-right{
margin-left: 20px;
}
.download-file-name{
font-size: 20px;
}
PHP代码:(这是整个文件的代码,粘贴时记得把那个PHP文件里面的代码【清空!清空!清空!】)
<?php
/**
* Template name: Zibll-资源下载
* Description: download page
*/
if (empty($_GET['post'])) {
get_header();
get_template_part('template/content-404');
get_footer();
exit;
}
get_header();
$post_id = $_GET['post'];
function zibpay_get_down_html($post_id)
{
$pay_mate = get_post_meta($post_id, 'posts_zibpay', true);
$html = '';
if (empty($pay_mate['pay_type']) || empty($pay_mate['pay_type']) || $pay_mate['pay_type'] != '2') {
return get_template_part('template/content-404');
};
// 查询是否已经购买
$paid_obj = zibpay_is_paid($post_id);
$posts_title = get_the_title($post_id) . get_post_meta($post_id, 'subtitle', true);
$pay_title = !empty($pay_mate['pay_title']) ? $pay_mate['pay_title'] : $posts_title;
$pay_doc = $pay_mate['pay_doc'];
$pay_details = $pay_mate['pay_details'];
if ($paid_obj) {
//已经购买直接显示下载盒子
$paid_name = zibpay_get_paid_type_name($paid_obj['paid_type']);
$paid_name = '<b class="badg jb-red mr6" style="margin-left: 5px; font-size: 12px; padding: 2px 10px; line-height: 1.4; "><i class="fa fa-check mr6" aria-hidden="true"></i>' . $paid_name . '</b>';
$pay_extra_hide = !empty($pay_mate['pay_extra_hide']) ? '<div class="pay-extra-hide">' . $pay_mate['pay_extra_hide'] . '</div>' : '';
$dowmbox = '<div style="/*margin-bottom:3em;*/">' . zibpay_get_post_down_buts($pay_mate, $paid_obj['paid_type'], $post_id) . '</div>';
if ($paid_obj['paid_type'] == 'free' && _pz('pay_free_logged_show') && !is_user_logged_in()) {
$dowmbox = '<div class="alert jb-yellow em12" style="margin: 2em 0;"><b>免费资源,请登录后下载</b></div>';
$pay_extra_hide = '<div class="text-center pay-extra-hide">';
$pay_extra_hide .= '<p class="box-body muted-2-color">请先登录!</p>';
$pay_extra_hide .= '<p>';
$pay_extra_hide .= '<a href="javascript:;" class="signin-loader but jb-blue padding-lg"><i class="fa fa-fw fa-sign-in mr10" aria-hidden="true"></i>登录</a>';
$pay_extra_hide .= '<a href="javascript:;" class="signup-loader ml10 but jb-yellow padding-lg"><i data-class="icon mr10" data-viewbox="0 0 1024 1024" data-svg="signup" aria-hidden="true"></i>注册</a>';
$pay_extra_hide .= '</p>';
$pay_extra_hide .= zib_social_login(false);
$pay_extra_hide .= '</div>';
}
$html = '<div class="download-demo"><div class="panel-heading"><h3><i class="fa fa-paper-plane-o" aria-hidden="true"></i> 文件下载</h3></div>';
$html .= '<div class="download-wiui">';
/*微信公众号图片在下面的<img>里面,自己放自己的图片链接 文字自己修改*/
$html .= '<div class="download-sty"><img src="https://a.daenzy.com/wp-content/uploads/2022/01/qqqun.png" /><p>进入Daen群聊不迷路</p></div>';
$html .= '<div class="download-right"><div class="article-header download-theme-box"><div class="article-title" style="margin-top: 0;"><span class="download-file-name">[文件名] </span><a href="' . get_permalink($post_id) . '#posts-pay">' . $pay_title . '</a></div>' . $paid_name . '</div>';
$html .= '<div>' . $pay_doc . '</div>';
$html .= '<div class="muted-2-color em09">' . $pay_details . '</div>';
$html .= '<div>' . $dowmbox . $pay_extra_hide . '</div></div>';
$html .= '</div></div>';
} else {
//未购买
$html = '<div class="article-header theme-box"><div class="article-title"><a href="' . get_permalink($post_id) . '#posts-pay">' . $pay_title . '</a></div></div>';
$html .= '<div>' . $pay_doc . '</div>';
$html .= '<div class="muted-2-color em09" style="margin: 2em 0;">' . $pay_details . '</div>';
$html .= '<div class="alert jb-red em12" style="margin: 2em 0;"><b>暂无下载权限</b></div>';
$html .= '<a style="margin-bottom: 2em;" href="' . get_permalink($post_id) . '#posts-pay" class="but jb-yellow padding-lg"><i class="fa fa-long-arrow-left" aria-hidden="true"></i><span class="ml10">返回文章</span></a>';
}
return $html;
}
?>
<style>
.but-download>.but,.but-download>span{min-width: 200px;padding: .5em;margin-top: 10px;}.pay-extra-hide{background: var(--muted-border-color);display: block;margin: 10px;padding: 20px;color: var(--muted-color);border-radius: 4px;}
</style>
<main class="container">
<div class="content-wrap">
<div class="content-layout">
<?php while (have_posts()) : the_post(); ?>
<?php echo zib_get_page_header(); ?>
<div class="zib-widget article download-article" style="/*min-height: 600px;*/">
<?php
echo zibpay_get_down_html($post_id);
$page_links_content_s = get_post_meta(get_queried_object_id(), 'page_show_content', true);
if ($page_links_content_s) {
the_content();
wp_link_pages(
array(
'before' => '<p class="text-center post-nav-links radius8 padding-6">',
'after' => '</p>',
)
);
echo '</div>';
}
?>
<!--开始-->
<style>
.but-download>.but,.but-download>span{min-width: 200px;padding: .5em;margin-top: 10px;}.pay-extra-hide{background: var(--muted-border-color);display: block;margin: 10px;padding: 20px;color: var(--muted-color);border-radius: 4px;}
.panel:hover,.download-demo:hover{border: 1px dashed #FF6666;}/*框颜色背景色*/
.panel:hover h3,.download-demo:hover h3{color:#fff;}
.panel{margin-bottom: 10px; background-color: #fff; border: 1px dashed #268df7; border-radius: 4px; -webkit-box-shadow: 0 1px 1px rgba(0,0,0,.05); box-shadow: 0 1px 1px rgba(0,0,0,.05);}
.panel-heading{padding: 10px 15px;border-bottom: 1px solid #268df7;border-top-left-radius: 3px;border-top-right-radius: 3px;color: #0000FF;background-color: #99CCFF;}/*边框部分颜色*/
.panel-heading h3{margin-top: 0;margin-bottom: 0;font-size: 14px;color: #0000FF;font-family: inherit;font-weight: 500;line-height: 1.1;}
.panel-body .help li{line-height:25px;font-size:14px;color: #000;}
.panel-body .help li em{font-style:normal;background: #FFFFCC;padding:5px;border-radius:4px;color: #FF3399;}
.panel-body .shengming{line-height:25px;font-size:14px;color:#C33;}
</style>
<div class="panel">
<div class="panel-heading">
<h3><i class="fa fa-paper-plane-o" aria-hidden="true"></i> 下载说明</h3>
</div>
<div class="panel-body">
<ul class="help">
<li>1.DaenGAME所提供的压缩包若无特别说明,解压密码均为<em>Daen</em>;</li>
<li>2.下载后文件若为压缩包格式,请安装7Z软件或者其它压缩软件进行解压;</li>
<li>3.文件比较大的时候,建议使用下载工具进行下载,浏览器下载有时候会自动中断,导致下载错误;</li>
<li>4.资源可能会由于内容问题被和谐,导致下载链接不可用,遇到此问题,请到文章页面进行反馈,以便DaenGAME及时进行更新;</li>
<li>5.软件安装时提示要激活码的话,请各位仔细看文章,激活码会放在文章里的!</li>
</ul>
</div>
</div>
<div class="panel">
<div class="panel-heading">
<h3><i class="fa fa-paper-plane-o" aria-hidden="true"></i> 站长声明</h3>
</div>
<div class="panel-body">
<span class="shengming">本站大部分下载资源收集于网络,只做学习和交流使用,版权归原作者所有,若为付费资源,请在下载后24小时之内自觉删除,若作商业用途,请到原网站购买,由于未及时购买和付费发生的侵权行为,与本站无关。本站发布的内容若侵犯到您的权益,请联系本站删除,我们将及时处理!</span>
</div>
</div>
<!--结束-->
<?php ?>
<?php endwhile; ?>
</div>
<?php comments_template('/template/comments.php', true); ?>
</div>
</div>
<?php get_sidebar(); ?>
</main>
<?php
get_footer();
第二款下载美化!!
直接替换独立下载页面即可!无需css代码
<?php
/**
* Template name: XY-资源下载
* Description: XY-独立资源下载页面
*/
if (empty($_GET['post'])) {
get_header();
get_template_part('template/content-404');
get_footer();
exit;
}
get_header();
$post_id = $_GET['post'];
function zibpay_get_down_html($post_id)
{
$pay_mate = get_post_meta($post_id, 'posts_zibpay', true);
$html = '';
if (empty($pay_mate['pay_type']) || empty($pay_mate['pay_type']) || $pay_mate['pay_type'] != '2') {
return get_template_part('template/content-404');
};
//文章略缩图
$thumbnail = zib_post_thumbnail('full', '', true, $post_id);
// 查询是否已经购买
$paid_obj = zibpay_is_paid($post_id);
$posts_title = get_the_title($post_id) . get_post_meta($post_id, 'subtitle', true);
$pay_title = !empty($pay_mate['pay_title']) ? $pay_mate['pay_title'] : $posts_title;
$pay_doc = $pay_mate['pay_doc'];
$pay_details = $pay_mate['pay_details'];
$user_qx = zibpay_get_post_down_buts($pay_mate, $paid_obj['paid_type'], $post_id);
if ($paid_obj) {
//已经购买直接显示下载盒子
$paid_name = zibpay_get_paid_type_name($paid_obj['paid_type']);
$paid_name2 = '<badge class="img-badge left jb-red" style="z-index: 2;font-size: 12px;padding: 2px 10px;line-height: 1.4;" img-badge="" left=""><i class="fa fa-check mr6" aria-hidden="true"></i>' . $paid_name . '</badge>';
if($paid_name =='推广会员免费'||$paid_name =='代理会员免费'){
$dowmbox = '<div style="/*margin-bottom:3em;*/">' . $user_qx . '</div>';
}else{
$dowmbox = '<div style="/*margin-bottom:3em;*/"><span class="badg c-red btn-block">免费资源不占用会员的免费下载次数</span>' . $user_qx . '</div>';
}
$pay_extra_hide = !empty($pay_mate['pay_extra_hide']) ? '<div class="pay-extra-hide">' . $pay_mate['pay_extra_hide'] . '</div>' : '';
if ($paid_obj['paid_type'] == 'free' && _pz('pay_free_logged_show') && !is_user_logged_in()) {
$dowmbox = '<div class="alert jb-yellow em12" style="margin: 2em 0;"><b>免费资源,请登录后下载</b></div>';
$pay_extra_hide = '<div class="text-center pay-extra-hide">';
$pay_extra_hide .= '<p class="box-body muted-2-color">请先登录!</p>';
$pay_extra_hide .= '<p>';
$pay_extra_hide .= '<a href="javascript:;" class="signin-loader but jb-blue padding-lg"><i class="fa fa-fw fa-sign-in mr10" aria-hidden="true"></i>登录</a>';
$pay_extra_hide .= '<a href="javascript:;" class="signup-loader ml10 but jb-yellow padding-lg"><i data-class="icon mr10" data-viewbox="0 0 1024 1024" data-svg="signup" aria-hidden="true"></i>注册</a>';
$pay_extra_hide .= '</p>';
$pay_extra_hide .= zib_social_login(false);
$pay_extra_hide .= '</div>';
}
$html = '<div class="download-demo">';
$html .= '<div class="download-xiyang"><div class="download-right">';
/*获取文章略缩图*/
$html .= '<div class="download-sty item-thumbnail">' . $paid_name2 . '<img src="'.$thumbnail.'" /></div>';
$html .= '<span class="display">' . $paid_name2 . '</span><div class="article-header download-theme-box"><div class="article-title" style="margin-top: 0;"><span class="download-file-name"></span><a href="' . get_permalink($post_id) . '#posts-pay">' . $pay_title . '</a></div></div>';
$html .= '<div>' . $pay_doc . '</div>';
$html .= '<div class="muted-2-color em09">' . $pay_details . '</div>';
$html .= '<div>' . $dowmbox . $pay_extra_hide . '</div></div>';
$html .= '</div></div>';
} else {
//未购买
$html = '<div class="article-header theme-box"><div class="article-title"><a href="' . get_permalink($post_id) . '#posts-pay">' . $pay_title . '</a></div></div>';
$html .= '<div>' . $pay_doc . '</div>';
$html .= '<div class="muted-2-color em09" style="margin: 2em 0;">' . $pay_details . '</div>';
$html .= '<div class="alert jb-red em12" style="margin: 2em 0;"><b>暂无下载权限</b></div>';
$html .= '<a style="margin-bottom: 2em;" href="' . get_permalink($post_id) . '#posts-pay" class="but jb-yellow padding-lg"><i class="fa fa-long-arrow-left" aria-hidden="true"></i><span class="ml10">返回文章</span></a>';
}
return $html;
}
?>
<style>
.mb10{display:none;}
.but-download>.but,.but-download>span{min-width: 200px;padding: .5em;margin-top: 10px;}.pay-extra-hide{background: var(--muted-border-color);display: block;margin: 10px;padding: 20px;color: var(--muted-color);border-radius: 4px;}
/*下载样式*/
.but-download{display: table-cell;}.download-article{margin-bottom: 40px !important;padding: 0 10px;width: 100%;margin: 0 auto;}.download-demo{margin: 10px 0;}.download-xiyang{padding: 0 0 20px;display: flex;justify-content: center;align-items: center;}.download-sty{text-align: center;height: 260px;border-radius: 8px;position: relative;}@media (max-width:530px){.but-download {display: block;}.but-download>.but, .but-download>span{min-width: 100% !important;}}@media (max-width:700px){.download-sty{display: none;}.download-right{padding: 10px !important;height: 100% !important;width: 100%;}.download-theme-box{margin-top: 24px;}}@media (min-width:700px){.display{display: none;}}@media (min-width: 1100px){.download-article{width:900px;}}@media (max-width: 950px){.download-notice{display: flex;}.head h2{font-size: 30px !important;}}.download-sty img{position: relative;}.download-theme-box{margin:10px 0 20px 0;text-align: center;}.download-right{margin-left: 6px;border: 1px solid #f04494;padding: 24px;border-radius: 8px;position: relative;}.download-file-name{font-size: 20px;}
.but-download>.but,.but-download>span{min-width: 130px;padding: .5em;margin-top: 10px;}.pay-extra-hide{background: var(--muted-border-color);display: block;margin: 10px;padding: 20px;color: var(--muted-color);border-radius: 4px;}
.panel{margin-bottom: 10px; background-color: #fff; border: 1px solid var(--theme-color); border-radius: 4px; -webkit-box-shadow: 0 1px 1px rgba(0,0,0,.05); box-shadow: 0 1px 1px rgba(0,0,0,.05);}
.panel-heading{padding: 10px 15px;border-top-left-radius: 3px;border-top-right-radius: 3px;color: #fff;background-color: var(--focus-color);}/*边框部分颜色*/
.panel-heading h3{margin-top: 0;margin-bottom: 0;font-size: 14px;color: #0000FF;font-family: inherit;font-weight: 500;line-height: 1.1;}
.panel-body .shengming{line-height:25px;font-size:14px;color:#C33;}
.head{height: 80px;letter-spacing: 8px;color: #fff;background: url(//21lhz.cn/cdn/dl_head.png) center no-repeat;text-align: center;border-radius: 10px 10px 0 0;position: relative;top: -20px;margin: -10px;margin-bottom: 20px;}
.head h2{line-height: 90px;font-size: 40px;}
.download-notice {padding: 24px;border-top: 1px solid #e5e5e5;position: relative;margin: 0px -10px;border-radius: 0 0 8px 8px;}
.download-notice-title {width: 190px;height: 100px;margin-right: 18px;margin-top: 4px;padding-top: 32px;border-right: 1px solid #ccc;text-align: center;font-size: 28px;color: #999;font-family: microsoft yahei;font-weight: 700;}
.download-notice-ico {width: 36px;height: 29px;background-position: 0 -372px;}
.ico {background-image: url(//21lhz.cn/cdn/ico_png24.png);background-repeat: no-repeat;}
.fl {float: left;display: inline;}.red1 {color: #eb0064;font-size: 14px;}.mb5 {margin-right: 5px;margin-bottom: 5px;}.vertical-middle {vertical-align: middle;}.download-notice-detail p {font: 13px/1.25 "microsoft yahei",simsun,arial;}
.popTipBox {padding: 5px 10px;text-indent: 2em;border: 1px solid #ffd8c0;background-color: #fff9f3;font-size: 13px;color: #e10074;line-height: 22px;}
.but-download a{margin-left: 10px;margin-right: 4px;}
</style>
<main class="container">
<div class="content-wrap">
<div class="content-layout">
<?php while (have_posts()) : the_post(); ?>
<?php echo zib_get_page_header(); ?>
<div class="zib-widget article download-article">
<div class="head"><h2>资源下载页</h2></div>
<?php
echo zibpay_get_down_html($post_id);
$page_links_content_s = get_post_meta(get_queried_object_id(), 'page_show_content', true);
if ($page_links_content_s) {
the_content();
wp_link_pages(
array(
'before' => '<p class="text-center post-nav-links radius8 padding-6">',
'after' => '</p>',
)
);
echo '</div>';
}
?>
<!--开始-->
<div style="padding:0 15px 15px 15px">
<div class="popTipBox">下载的资源使用前请仔细核对文字内容,如资源中包含国旗、国徽、党徽、天安门等图片,请在《中华人民共和国国旗法》、《中华人民共和国国徽法》等相关法律法规规定范围内使用,请保证国旗、国徽、天安门等图案的完整性,如因违规使用造成的一切经济损失及法律责任,将由您自行承担。
</div>
</div>
<dl class="download-notice clearfix zib-widget">
<dt class="fl download-notice-title"><span class="inline-block vertical-middle mr5 mb5 download-notice-ico ico"></span>注意事项</dt>
<dd class="download-notice-detail">
<p><b class="red1">本站大部分下载资源收集于网络,只做学习和交流使用,版权归原作者所有。</b></p>
<p>若为付费资源,请在下载后24小时之内自觉删除,若作商业用途,请到原网站购买,由于未及时购买和付费发生的侵权行为,与本站无关。</p>
<p>本站发布的内容若侵犯到您的权益,请联系夕阳删除,我们将及时处理!</p>
<p><b>如下载有问题请重新下载,文件自下载之日起,可免费重复下载。若文件有问题,请及时联系夕阳处理。</b></p>
</dd>
</dl>
<!--结束-->
<?php ?>
<?php endwhile; ?>
</div>
<?php comments_template('/template/comments.php', true); ?>
</div>
</div>
<?php get_sidebar(); ?>
</main>
<?php
get_footer();
注意:
- PHP文件路径:主题文件夹/zibll/pages/download.php
- 有一些文字说明比如:站长声明、下载说明,自己在代码中修改一下。
- 微信公众号的图片+文字,代码里面有注释提示的,自己改一下就好。
- 有疑问请留言。
第一款截图
第二款截图
HTML小工具没啥好说的,自己打开【网站后台】-【外观】-【小工具】-【自定义HTML】,放在侧边栏就OK了。把下面的代码放进去就大功告成啦!(不会的自己琢磨,太笨就算了)
<style>
.wiui-rqyy-demo {
width: 100%;
height: 180px;
position: relative;
}
.wiui-rqyy-item {
width: 100%;
height: 100%;
padding: 5px;
box-sizing: border-box;
color: white;
text-align: center;
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
cursor: pointer;
background-image: url(/mh/img/cebianlan/yiyan/rqyy-bg-5.png);
}
.wiui-rqyy-date {
font-family: Arial, Helvetica, sans-serif;
}
.wiui-rqyy-day {
font-size: 2.5rem;
font-weight: 700;
}
.wiui-rqyy-month {
font-weight: 700;
font-size: 2rem;
}
.wiui-rqyy-month::before {
content: "/";
padding-right: 2px;
}
.wiui-rqyy-text {
position: absolute;
width: 90%;
height: auto;
line-height: 30px;
font-family: "宋体";
font-size: 1.5rem;
font-weight: 700;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.wiiui-rqyy-yy::after {
display: inline-block;
content: "_";
animation: fadeInHX 1s;
animation-iteration-count: infinite;
}
@keyframes fadeInHX {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.wiui-rqyy-btn {
display: inline-block;
font-family: "新宋体";
font-weight: 700;
position: absolute;
right: 0;
bottom: 0;
margin: 10px;
}
#wiui-yybtn {
width: 100%;
position: relative;
}
#wiui-yybtn:hover {
color: #e99896;
}
#wiui-yybtn:hover > .wiui-rqyy-msg {
visibility: unset;
}
.wiui-rqyy-icon {
font-size: 18px;
}
.wiui-rqyy-msg {
visibility: hidden;
font-size: 10px;
color: #9784a0;
position: absolute;
padding: 5px;
top: -5px;
left: -60px;
border-radius: 2px;
background: white;
transition: all 0.2s;
}
.wiui-rqyy-msg::after {
content: " ";
display: inline-block;
width: 9px;
height: 9px;
background: white;
position: absolute;
top: 10px;
transform: rotate(45deg);
border-radius: 2px;
}
</style>
<div class="wiui-rqyy-demo">
<div class="wiui-rqyy-item">
<div class="wiui-rqyy-date">
<span class="wiui-rqyy-day">-</span>
<span class="wiui-rqyy-month">-</span>
</div>
<div class="wiui-rqyy-text">
<span class="wiiui-rqyy-yy">加载中...</span>
</div>
<div class="wiui-rqyy-btn">
<div id="wiui-yybtn">
<span class="wiui-rqyy-msg">换一句</span>
<i class="fa fa-dot-circle-o wiui-rqyy-icon" aria-hidden="true"></i>
</div>
</div>
</div>
</div>
<script>
$(function () {
var myDate = new Date();
var mon = myDate.getMonth() + 1;
var day = myDate.getDate();
var newMon = mon < 10 ? "0" + mon : mon;
var newDay = day < 10 ? "0" + day : day;
var rqyyLock = true;
var randRYY = parseInt(Math.random() * 10);
$(".wiui-rqyy-item").css(
"background-image",
"url(/mh/img/cebianlan/yiyan/rqyy-bg-" + randRYY + ".png)"
);
$(".wiui-rqyy-day").html(newDay);
$(".wiui-rqyy-month").html(newMon);
$.extend({
yyAjax: function () {
$.ajax({
// 链接
url: "https://api.btstu.cn/yan/api.php?charset=utf-8&encode=json",
// 请求方法
type: "GET",
// 成功返回
dataType: "json",
success: function (e) {
rqyyLock = false;
var yiyanList = e.text.split("");
var newYY = "";
var yyIndex = 0;
var timer = setInterval(function () {
newYY += yiyanList[yyIndex];
yyIndex++;
if (yyIndex >= yiyanList.length) {
clearInterval(timer);
rqyyLock = true;
}
$(".wiiui-rqyy-yy").html(newYY);
}, 150);
}
});
}
});
$.yyAjax();
$("#wiui-yybtn").click(function () {
if (!rqyyLock) return;
$.yyAjax();
});
});
$(".wiui-rqyy-demo").parent().parent().css({
padding: "0",
overflow: "hidden"
});
</script>
效果图如下:
在后台自定义代码css中加入以下代码
/*评论美化*/
.comment-mini-lists>div.posts-mini {
border: 1px dashed #999999;
border-radius: 10px;
margin-top: 10px;
}
效果图
1.第一步:在…/themes/zibll”zibll主题目录下新建目录名称为(comment_barrage)在建立js文件名称为(comment-barrage-min),和PHP文件名称为(wiiuii-comment-barrage)然后粘贴下面代码,一定要是“zibll/comment_barrage/”目录
JS代码
;eval(function(p,a,c,k,e,r){e=function(c){return(c<62?'':e(parseInt(c/62)))+((c=c%62)>35?String.fromCharCode(c+29):c.toString(36))};if('0'.replace(0,e)==0){while(c--)r[e(c)]=k[c];k=[function(e){return r[e]||e}];e=function(){return'([4-9abdf-mo-zA-Z]|1\\w)'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('k 7=M.N($(\'.g-w-O\').l(0).width())||300;k $8=$(\'.g-F-one\'),$9=$(\'.g-F-two\'),$a=$(\'.g-F-three\');k P=-310;k z=b;x 5(A,f,Q,wiui_left){let R=$(A).m().length;d(R<1){G h}$(A).animate({H:P+"px"},Q*20,\'o\',x(){$(6).css(\'H\',0);d(!f.p(":q")&&f.r(\'s-t\')===\'1\'){$9.B($(6).m().l(0).C(b))}u d(!f.p(":q")&&f.r(\'s-t\')===\'2\'){$a.B($(6).m().l(0).C(b))}u d(!f.p(":q")&&f.r(\'s-t\')===\'3\'){$8.B($(6).m().l(0).C(b))}u{f.B($(6).m().l(0).C(b))}$(6).m().l(0).remove();5(A,f,7)})}5($8,$9,7);5($9,$a,7+I);5($a,$8,7+4);$(\'.g-w-O\').hover(x(){$(6).y().D(b,h)},x(){k i=7-(-M.N($(6).y().position().H));i=i<0?7:i;d($(6).y().r("s-t")===\'1\'){5($8,$9,i)}u d($(6).y().r("s-t")===\'2\'){5($9,$a,i)}u d($(6).y().r("s-t")===\'3\'){5($a,$8,i)}});$(E).scroll(x(){k S=$(E).T()>$(".g-J-w").U().V+$(".g-J-w").outerHeight()||$(E).T()+$(E).height()<$(".g-J-w").U().V;try{d(S){d($8.p(":q")||$9.p(":q")||$a.p(":q")){$8.D(b,h);$9.D(b,h);$a.D(b,h)}z=b}u{d(!z){G h}5($8,$9,7);5($9,$a,7+I);5($a,$8,7+4);z=h}}catch(e){G h}});console.log("\\n %c 滚动评论弹幕 - https://a.daenzy.com","color:#fff; W: X-j(K% 4% Y I% 0%, #00FF94 0%, rgba(0, 255, 148, 0.25) 4%), o-j(230deg, #000000 25%, #170059 4%), o-j(215deg, #FFEBB9 10%, #19004E 80%), X-j(4% 245% Y 4% 4%, #FFFFFF 0%, #000353 4%), o-j(125deg, #1400FF 0%, #3A0000 4%), o-j(225deg, #Z 30%, #11 45%, #13 45%, #v K%, #14 K%, #v 85%, #17 85%, #v 4%), o-j(135deg, #Z 0%, #11 15%, #13 15%, #v 35%, #14 35%, #v 55%, #17 55%, #v 4%);W-blend-mode: soft-light, screen, L, L, difference, L, normal;padding:5px; border-radius: 4px;");',[],70,'||||100|wiui_widgetsBanone|this|wiui_e_speed|wiui_class_one|wiui_class_two|a|true||if||wiui_next_class|wiui_widgets|false|new_wiui_speed|gradient|var|eq|children||linear|is|animated|attr|data|index|else|001676|barrage|function|parent|wiui_commentbarrage_look|wiui_class|append|clone|stop|window|comments|return|left|50|comment|65|overlay|Math|round|item|_wiui_left|wiui_speed|chilen|is_ommentbarrage|scrollTop|offset|top|background|radial|at|00F0FF||000B6F||00EBFC|00E1F6|||00ECFD'.split('|'),0,{}));
PHP代码
<?php
// 名称: WIIUII - 评论弹幕模块
// 描述:由星语一人独立制作并美化,更多精彩美化请关注“星语的小木屋(WIIUII.CN)。
// 版本:V1.0.0
class wiiuiiCommentBarrage extends WP_Widget{
function __construct(){
$widget_ops = array('classname' => 'wiiuiiCommentBarrage', 'description' => '星语独立开发显示网站评论弹幕小模块(更多精彩美化请关注“星语的小木屋(WIIUII.CN)”)');
parent::__construct( false, 'WIIUII - 评论弹幕模块', $widget_ops);
}
function form($instance){
$instance = wp_parse_args(
(array)$instance,
array(
'title' => '评论弹幕',
'comment_num' => 30,
'in_display' => 'all'
)
);
$title = htmlspecialchars($instance['title']);
$comment_num = htmlspecialchars($instance['comment_num']);
$in_display_all = $instance['in_display'] == 'all' ? 'checked' : '';
$in_display_pc = $instance['in_display'] == 'pc' ? 'checked' : '';
$in_display_sm = $instance['in_display'] == 'sm' ? 'checked' : '';
// 后台HTML
$wiui_html_style = '<style>.wiiuii-stamode-main>div{margin:5px auto}.wiiuii-stamode-img img{margin: 5px auto;max-height:90px;display:inline-block;vertical-align:middle;border-radius:5px}.wiiuii-stamode-con{display:flex;flex-direction:row}.wiiuii-stamode-con>input{width:100%}.wiiuii-stamode-con>.button{margin-left:5px}</style>';
$wiui_html = $wiui_html_style;
$wiui_html .= '<div class="wiiuii-stamode-main">';
$wiui_html .= '<div><div><b>标题</b></div>';
$wiui_html .= '<div><input style="width:100%" id="'.$this->get_field_id('title') .'" name="'.$this->get_field_name('title').'" type="text" value="'.$instance['title'].'" /></div></div>';
$wiui_html .= '<div><div><b>弹幕评论数</b><i style="color:red;">每行的评论数必须一样,3n</i></div>';
$wiui_html .= '<div><input style="width:100%" id="'.$this->get_field_id('comment_num') .'" name="'.$this->get_field_name('comment_num').'" type="text" value="'.$instance['comment_num'].'" /></div></div>';
// 显示规则
$wiui_html .= '<div><div><b>显示效果</b></div>';
$wiui_html .= '<div><label><input style="vertical-align:-3px;margin-right:4px;" class="radio" type="radio" id="'.$this->get_field_id('in_display').'" name="'.$this->get_field_name('in_display').'" '. $in_display_all . ' value="all"/> PC端/移动端均显示</label></div>';
$wiui_html .= '<div><label><input style="vertical-align:-3px;margin-right:4px;" class="radio" type="radio" id="'.$this->get_field_id('in_display').'" name="'.$this->get_field_name('in_display').'" '. $in_display_sm . ' value="sm"/> 仅在手机端显示</label></div>';
$wiui_html .= '<div><label><input style="vertical-align:-3px;margin-right:4px;" class="radio" type="radio" id="'.$this->get_field_id('in_display').'" name="'.$this->get_field_name('in_display').'" '. $in_display_pc . ' value="pc"/> 仅在电脑端显示</label></div></div>';
$wiui_html .= '</div>';
$wiui_html .= '<b style="color:red;">*最好不要放到侧边栏,建议放到首页-底部全宽度。</b>';
echo $wiui_html;
}
function update($new_instance, $old_instance){
$instance = $old_instance;
$instance['title'] = strip_tags(stripslashes($new_instance['title']));
$instance['comment_num'] = strip_tags(stripslashes($new_instance['comment_num']));
$instance['in_display'] = $new_instance['in_display'];
return $instance;
}
function widget($args, $instance){
extract($args);
$title = apply_filters('widget_title',empty($instance['title']) ? ' ' : $instance['title']);
$comment_num = empty($instance['comment_num']) ? 30 : $instance['comment_num'];
if($instance['in_display'] == 'pc'){
$in_display = 'hidden-xs';
}else if($instance['in_display'] == 'sm'){
$in_display = 'visible-xs-block';
}
// 前端HTML
echo '<div class="mb20 ' . $in_display . '">';
echo '<div class="box-body notop"><div class="title-theme">'. $title .'</div></div>';
echo $before_widget;
$this->wiiuii_get_websitestat($comment_num);
echo '</div>';
echo $after_widget;
wp_enqueue_script('wiiuii_script', get_bloginfo( 'stylesheet_directory' ) . '/comment_barrage/comment-barrage-min.js');
}
function wiiuii_get_websitestat($comment_num){
$wiiuii_args = array(
'status' => 'approve',
'number' => $comment_num,
'order' => 'desc'
);
$comments = get_comments($wiiuii_args);
$left_num = array(0,50,100);
foreach($comments as $index => $comment) {
$wiui_html_comment = '<li class="wiui_widgets-barrage-item"><div class="wiui_widgets-author-tx">'.get_avatar($comment->user_id,40).'</div><div class="wiui_widgets-author-info"><b class="wiui_widgets-author-name">'.zib_comment_filters($comment->comment_author).'</b><p class="wiui_widgets-author-comment"> ' . zib_comment_filters($comment->comment_content) . '</p></div></li>';
$wiui_comment_num = $comment_num / 3;
if($index < $wiui_comment_num){
$wiui_html_one .= $wiui_html_comment;
}else if($index < ($wiui_comment_num * 2)){
$wiui_html_two .= $wiui_html_comment;
}else{
$wiui_html_three .= $wiui_html_comment;
}
}
$wiui_html = '<style>.wiui_widgets-comment-barrage{width:100%;height:260px;padding:20px 0;background-color:var(--body-bg-color);box-sizing:border-box;overflow:hidden;border-radius: 5px}.wiui_widgets-barrage-container{position:relative;width:100%;height:100%}.wiui_widgets-barrage-row{position:absolute;display:flex;flex-direction:row;align-content:center;align-items:center;align-items:flex-start}.wiui_widgets-barrage-row>.wiui_widgets-barrage-item{width:300px;height:60px;display:flex;margin-right:10px;padding:5px;background-color:var(--main-bg-color);color:var(--main-color);align-items:flex-start;flex-direction:row;align-content:center;overflow:hidden;border-radius:8px;box-shadow:0 0 10px rgba(243,243%,243%,40%)}.wiui_widgets-barrage-item>.wiui_widgets-author-tx{width:45px;height:45px;flex:none;overflow:hidden;border-radius:99px}.wiui_widgets-barrage-item>.wiui_widgets-author-tx img{max-width:100%;max-height:100%}.wiui_widgets-author-info{flex:auto;margin-left:5px}.wiui_widgets-author-info>.wiui_widgets-author-name::after{content:":"}.wiui_widgets-author-info>.wiui_widgets-author-comment{font-size:14px;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;line-height:16px}.wiui_widgets-author-comment>img{width: 20px!important; height: 20px!important;}.wiui_widgets-barrage-item:hover{height:100%;z-index:9}.wiui_widgets-barrage-item:hover .wiui_widgets-author-comment{-webkit-box-orient:unset;-webkit-line-clamp:unset;overflow:unset}.wiui_widgets-comments-one{top:0}.wiui_widgets-comments-two{top:80px}.wiui_widgets-comments-three{top:160px}</style>';
$wiui_html .= '<div class="wiui_widgets-comment-barrage"><div class="wiui_widgets-barrage-container">';
$wiui_html .= '<ul class="wiui_widgets-barrage-row wiui_widgets-comments-one" data-index="1">';
$wiui_html .= $wiui_html_one;
$wiui_html .= '</ul>';
$wiui_html .= '<ul class="wiui_widgets-barrage-row wiui_widgets-comments-two" data-index="2">';
$wiui_html .= $wiui_html_two;
$wiui_html .= '</ul>';
$wiui_html .= '<ul class="wiui_widgets-barrage-row wiui_widgets-comments-three" data-index="3">';
$wiui_html .= $wiui_html_three;
$wiui_html .= '</ul>';
$wiui_html .= '</div></div>';
echo $wiui_html;
}
// 子比主题评论内容过滤【图片/表情】函数,感谢老唐的函数
function zib_comment_filters($cont, $type = '', $lazy = true)
{
$cont = convert_smilies($cont);
$cont = preg_replace('/\[img=(.*?)\]/', '<img class="box-img lazyload" src="$1" alt="评论图片' . zib_get_delimiter_blog_name() . '">', $cont);
if ('noimg' == $type) {
$cont = preg_replace('/\<img(.*?)\>/', '[图片]', $cont);
$cont = preg_replace('/\[code]([\s\S]*)\[\/code]/', '[代码]', $cont);
} else {
$cont = str_replace('[code]', '<pre><code>', $cont);
$cont = str_replace('[/code]', '</code></pre>', $cont);
}
$cont = preg_replace('/\[g=(.*?)\]/', '<img class="smilie-icon" src="' . ZIB_TEMPLATE_DIRECTORY_URI . '/img/smilies/$1.gif" alt="表情[$1]' . zib_get_delimiter_blog_name() . '">', $cont);
if (zib_is_lazy('lazy_comment') && $lazy) {
$cont = str_replace(' src=', ' src="' . zib_get_lazy_thumb() . '" data-src=', $cont);
}
$cont = wp_kses_post($cont);
return $cont;
}
}
function wiiuiiCommentBarrage(){
register_widget('wiiuiiCommentBarrage');
}
add_action('widgets_init','wiiuiiCommentBarrage');
?>
2.老唐为了防止更新主题时“functions.php”文件被覆盖,同时方便我们修改美化代码内容,所以他在“functions.php”文件引入了一个“func.php”文件,为防止更新主题后我们修改的代码内容被覆盖。(这非常的奈斯!!!),我在“func.php”文件中添加下面的代码,注册一下评论弹幕小工具。
require_once('comment_barrage/wiiuii-comment-barrage.php');
3.在网站后台——>外观——>小工具——>评论弹幕模块——>建议添加到“首页-底部全宽度”,即可OK!
效果图:
在主题目录“../zibll/”下,打开go.php文件(最好自己备份一份),把下面的代码覆盖进去即可。
<?php
/*
* @Author : Qinver
* @Url : zibll.com
* @Date : 2020-09-29 13:18:36
* @LastEditTime: 2022-04-28 21:25:40
* @Email : 770349780@qq.com
* @Project : Zibll子比主题
* @Description : 一款极其优雅的Wordpress主题
* @Read me : 感谢您使用子比主题,主题源码有详细的注释,支持二次开发。
* @Remind : 使用盗版主题会存在各种未知风险。支持正版,从我做起!
* @----本go页面有星语社长(WWW.WIIUII.CN)进行二次修改,禁止搬运,支持正版------。
*/
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);
$wiiui_title = get_bloginfo('name');
$title = $wiiui_title . ' - 安全中心';
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" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
<?php echo "<link rel='apple-touch-icon-precomposed icon' href='" . _pz('iconpng') . "' type='image/x-icon'/>"; ?>
<noscript>
<meta http-equiv="refresh" content="1;url='<?php echo $url; ?>';">
</noscript>
<script>
function link_jump() {
//禁止其他网站使用我们的跳转页面
var MyHOST = new RegExp("<?php echo $_SERVER['HTTP_HOST']; ?>");
if (!MyHOST.test(document.referrer)) {
location.href = "//" + MyHOST;
}
location.href = "<?php echo $url; ?>";
}
//延时10S跳转,可自行修改延时时间
setTimeout(link_jump, 10000);
//延时50S关闭跳转页面,用于文件下载后不会关闭跳转页的问题
setTimeout(function() {
window.opener = null;
window.close();
}, 50000);
</script>
<link rel="stylesheet" id="_fontawesome-css" href="//cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.min.css" type="text/css" media="all">
<title>
<?php echo $title; ?>
</title>
<style>
body,html{padding:0;margin:0}
body{background:#f5f6f7;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif}
a{cursor:default;text-decoration:none;word-wrap:break-word;word-break:break-all}
.wiiuii-go-main{display:flex;width:100%;height:100%;justify-content:center;align-items:center}
.wiiuii-go-container{position: relative;max-width:28em;height:auto;display:inline-block;background:#fff;margin:10px;padding:1.5em;border-radius:5px;box-shadow:0 0 10px rgba(116,116,116,.1)}
.wiiuii-go-content a{color:#036af4}
.wiiuii-go-content a:hover{color:#e91e63}
.wiiuii-go-logo{text-align:center;width:auto;height:65px;margin-bottom:10px}
.wiiuii-go-logo img{max-width:100%;height:100%}
.wiiuii-go-msg{cursor:default;text-align:center;padding:10px 5px;font-weight:700;color:rgba(255, 0, 0, 0.85);background:rgba(255, 0, 0, 0.1);border-radius:5px}
.wiiuii-go-button-item{text-align:right}
.wiiuii-go-button{display:inline-block;border-radius:99px;padding:10px 15px;background:rgba(116,116,116,.1);transition:all .5s}
.wiiuii-go-button a{font-weight:700;font-size:14px;color:#333}
.wiiuii-go-button:hover{color:#000;background:rgba(116,116,116,.2)}
.wiiuii-goid-item{position:absolute;top:10px;left:10px;border-radius:4px;overflow:hidden;background:#ffd07c}
.wiiuii-goid-title{padding:0 4px;background:#ffa400}
.wiiuii-goid-text{padding-right:5px}
.wiiuii-go-container hr{border: 0;height: 0.05em;background: #eee;}
</style>
</head>
<body>
<div class="wiiuii-go-main">
<div class="wiiuii-go-container">
<div class="wiiuii-goid-item">
<b class="wiiuii-goid-title">GID</b>
<span class="wiiuii-goid-text">LINK<?php echo hexdec($url); ?></span>
</div>
<div class="wiiuii-go-logo">
<?php echo zib_get_adaptive_theme_img(_pz('logo_src'), _pz('logo_src_dark')); ?>
</div>
<div class="wiiuii-go-content">
<div class="wiiuii-go-msg">
<span><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> 您即将离开<?php echo $wiiui_title; ?>,请注意您的账号和财产安全。</span>
</div>
<p>访问链接:<a onclick="location.replace('<?php echo $url; ?>')" title="<?php echo $url; ?>"><?php echo $url; ?></a></p>
</div>
<hr>
<div class="wiiuii-go-button-item">
<div class="wiiuii-go-button">
<a onclick="location.replace('//<?php echo $_SERVER['HTTP_HOST']; ?>')">返回首页</a>
</div>
<div class="wiiuii-go-button">
<a onclick="location.replace('<?php echo $url; ?>')">继续访问</a>
</div>
</div>
</div>
</div>
</body>
</html>
效果图
在后台主题设置[自定义CSS样式]添加下面CSS代码:
/*常-用-语样式*/
.wiiuii-words-li{margin:5px auto;padding:5px;background:var(--body-bg-color);border-radius:var(--main-radius)}
.wiiuii-words-li:hover{background:var(--float-btn-bg)}
JS代码
// 评-论-常-用-语JS
$('.wiiuii-words-li').on('click', function() {
var $wiiuii_comment = $('#comment');
var wiiuii_com_text = $(this).find('span').text();
var wiiuii_com_original = $wiiuii_comment.val();
$wiiuii_comment.val(wiiuii_com_original ? wiiuii_com_original + ' ' + wiiuii_com_text : wiiuii_com_text);
$('.wiui_words').removeClass('open');
});
第一步:在“../zibll/template/comments.php”子比主题的template目录下“comments.php”文件合适位置添加下面代码:【看截图】代码在120下方左右
// 常-用-语函数
if (_pz('comment_words', true)) {
echo zib_get_input_expand_but('wiui_words');
}
第二步:在“../zibll/inc/functions/functions.php”子比主题的template目录下“functions.php”文件合适位置添加下面代码:【看截图】代码搜索smilie 第2个上方添加
// 常-用-语函数
if ('wiui_words' == $type) {
$but = '<a class="but btn-input-expand mr6" href="javascript:;"><i class="fa fa-fw fa-comment-o"></i><span class="hide-sm">常用语</span></a>';
// 下面是自定义常用语,自己自定义喜欢常用语,最后不超过10条
$wiiuii_words_args = array('谢谢博主分享!', '博主NB,666', '感谢楼主分享!', '感谢大佬分享!', '教程很好用,谢谢!');
foreach ($wiiuii_words_args as $wiiuii_word) {
$wiui_word_index++;
$wiui_words .= '<li class="wiiuii-words-li"><b>' . $wiui_word_index . '、</b><span>' .$wiiuii_word . '</span>' . '</li>';
}
$dropdown = '<div class="dropdown-code">';
$dropdown .= '<span>请选择评论常用语:</span>';
$dropdown .= '<ul>';
$dropdown .= $wiui_words;
$dropdown .= '</ul>';
$dropdown .= '</div>';
}
【说明】评论常用语自己自定义,PHP代码中用注释,自己按格式写就好啦,最好不要超过10句。
效果
- 将xy_block.php放到子比主题里 例如:网站->wp-content->themes->zibll
- 将block_banned.php放到子比主题的pages文件里 例如:网站->wp-content->themes->zibll->pages
- 在functions.php引入文件代码如下:
if (file_exists(get_theme_file_path('/xy_block.php'))) {
require_once get_theme_file_path('/xy_block.php');
}
然后在网站后台新建页面,在默认模板里找到 XY-用户封禁 然后发布
小工具找到 Zibll用户封禁情况 然后填写信息 发布(这里推荐放在侧板栏)
效果图
html代码-放到后台自定义底部html
<!--鼠标右击列表-->
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@8"></script><style type="text/css">a{text-decoration:none}div.usercm{background-repeat:no-repeat;background-position:center center;background-size:cover;background-color:#fff;font-size:13px!important;width:130px;-moz-box-shadow:1px 1px 3px rgba(0,0,0,.3);box-shadow:0px 0px 15px#333;position:absolute;display:none;z-index:10000;opacity:0.9;border-radius:8px}div.usercm ul{list-style-type:none;list-style-position:outside;margin:0px;padding:0px;display:block}div.usercm ul li{margin:0px;padding:0px;line-height:35px}div.usercm ul li a{color:#666;padding:0 15px;display:block}div.usercm ul li a:hover{color:#fff;background:rgba(170,222,18,0.88)}div.usercm ul li a i{margin-right:10px}a.disabled{color:#c8c8c8!important;cursor:not-allowed}a.disabled:hover{background-color:rgba(255,11,11,0)!important}div.usercm{background:#fff!important}</style><div class="usercm"style="left: 199px; top: 5px; display: none;"><ul><li><a href="https://www.daenyx.com/"><i class="fa fa-home fa-fw"></i><span>首页</span></a></li><li><a href="javascript:void(0);"onclick="getSelect();"><i class="fa fa-copy fa-fw"></i><span>复制</span></a></li><li><a href="javascript:void(0);"onclick="baiduSearch();"><i class="fa fa-search fa-fw"></i><span>搜索</span></a></li><li style="border-bottom:1px solid gray"><a href="javascript:window.location.reload();"><i class="fa fa-refresh fa-fw"></i><span>重载网页</span></a></li><li><a href="https://www.daenyx.com/links"><i class="fa fa-meh-o fa-fw"></i><span>当我邻居吧</span></a></li><li><a href="https://www.daenyx.com/problem"><i class="fa fa-pencil-square-o fa-fw"></i><span>给我留言吧</span></a></li></ul></div><script type="text/javascript">(function(a){a.extend({mouseMoveShow:function(b){var d=0,c=0,h=0,k=0,e=0,f=0;a(window).mousemove(function(g){d=a(window).width();c=a(window).height();h=g.clientX;k=g.clientY;e=g.pageX;f=g.pageY;h+a(b).width()>=d&&(e=e-a(b).width()-5);k+a(b).height()>=c&&(f=f-a(b).height()-5);a("html").on({contextmenu:function(c){3==c.which&&a(b).css({left:e,top:f}).show()},click:function(){a(b).hide()}})})},disabledContextMenu:function(){window.oncontextmenu=function(){return!1}}})})(jQuery);function getSelect(){""==(window.getSelection?window.getSelection():document.selection.createRange().text)?layer.msg("啊噢...你没还没选择文字呢!"):document.execCommand("Copy")}function baiduSearch(){var a=window.getSelection?window.getSelection():document.selection.createRange().text;""==a?layer.msg("啊噢...你没还没选择文字呢!"):window.open("https://www.baidu.com/s?wd="+a)}$(function(){for(var a=navigator.userAgent,b="Android;iPhone;SymbianOS;Windows Phone;iPad;iPod".split(";"),d=!0,c=0;c<b.length;c++)if(0<a.indexOf(b[c])){d=!1;break}d&&($.mouseMoveShow(".usercm"),$.disabledContextMenu())});</script>
效果图
/*网站字体*/
@font-face{
font-family: 'zti';
src: url('https://www.daenyx.com/mh/ing/quanzhan/ziti/zitiu.woff2');
}
body{
font-family:'zti';
}
/*首页文章列表悬停上浮开始*/
@media screen and (min-width: 980px){.tab-content .posts-item:not(article){transition: all 0.2s;}.tab-content .posts-item:not(article):hover{transform: translateY(-5px); box-shadow: 0 8px 10px rgba(255, 112, 173, 0.35);}}
/*首页文章列表悬停上浮结束*/
/*文章随机彩色标签*/
.widget-tag-cloud.fixed-width .but:hover{opacity: 1;}.widget-tag-cloud.fixed-width .but{opacity: 0.6;line-height: 20px !important;padding: 4px 10px !important;font-size: 12px !important;}.widget-tag-cloud.fixed-width .but:nth-child(5n){background-color: #4A4A4A;color: #FFF}.widget-tag-cloud.fixed-width .but:nth-child(5n+1){background-color: #ff5e5c;color: #FFF}.widget-tag-cloud.fixed-width .but:nth-child(5n+2){background-color: #ffbb50;color: #FFF}.widget-tag-cloud.fixed-width .but:nth-child(5n+3){background-color: #1ac756;color: #FFF}.widget-tag-cloud.fixed-width .but:nth-child(5n+4){background-color: #19B5FE;color: #FFF}
点击图片的设置,点里面的叠加方案
<img src="/tp/wangzhan/shouye/sousuo/no.png" style="width:138px;height:60px;margin-top: 20px;margin-bottom: 13px;margin-left: 230px;margin-right: 50px">
素材图片你自己扒,或者找个合适自己风格的吧。
PC端和移动端的字体大小写12
func.php代码
//历史上的今天,代码来自柳城博主的 WP-Today 插件
function today_in_history(){
//$title = ZXM_options('today_in_history_title') ? ZXM_options('today_in_history_title') : "历史上的今天呀"; // $title = "历史上的今天";
//$limit = ZXM_options('today_in_history_num') ? ZXM_options('today_in_history_num') : 5; // $limit = 5;
// $title = "历史上的今天";
$limit = 5;
global $wpdb;
$post_year = get_the_time('Y');
$post_month = get_the_time('m');
$post_day = get_the_time('j');
$sql = "select ID, year(post_date_gmt) as h_year, post_title, comment_count FROM
$wpdb->posts WHERE post_password = '' AND post_type = 'post' AND post_status = 'publish'
AND year(post_date_gmt)!='$post_year' AND month(post_date_gmt)='$post_month' AND day(post_date_gmt)='$post_day'
order by post_date_gmt DESC limit $limit";
$histtory_post = $wpdb->get_results($sql);
if( $histtory_post ){
foreach( $histtory_post as $post ){
$h_year = $post->h_year;
$h_post_title = $post->post_title;
$h_permalink = get_permalink( $post->ID );
$h_comments = $post->comment_count;
$h_post .= "<li><lable>$h_year</lable>:<a href='".$h_permalink."' style='color:blue' title='Permanent Link to ".$h_post_title."'>$h_post_title <span>($h_comments)</span></a></li>";
}
}
$arr_month = array( 1=>"一月",2=>"二月",3=>"三月",4=>"四月",5=>"五月",6=>"六月",7=>"七月",8=>"八月",9=>"九月",10=>"十月",11=>"十一",12=>"十二" );
foreach($arr_month as $key => $value){
if($post_month == $key){
$month_l = $value;
}
}
if ( $h_post ){
$result = '
<section class="today-in-history">
<fieldset>
<legend>
<div class="today-date">
<span class="month">'.$month_l.'</span>
<span class="day">'.$post_day.'</span>
</div> <h3>历史上的今天</h3>
</legend>
<ul>'.$h_post.'</ul>
</fieldset>
</section>';
}else{
$result = '<section class="today-in-history">
<fieldset>
<legend>
<div class="today-date">
<span class="month">'.$month_l.'</span>
<span class="day">'.$post_day.'</span>
</div>
<h3>历史上的今天</h3>
</legend>
<ul>"吼吼~~~,往年的今天博主不知道跑哪里偷懒去了~~~"</ul>
</fieldset>
</section>';
}
echo $result;
}
css代码
/**====================历史上的今天模块样式====================*/
.today-in-history{
display: block;
position: relative;
width: 100%;
height: auto;
margin: 0 auto;
border: 0;
padding: 0;
}
.today-in-history fieldset{
display: block;
width: 100%;
height: auto;
margin: 0 auto;
border: 1px dashed #999;
padding: 0;
}
.today-in-history fieldset legend{
display: block;
width: auto;
/*max-width: 200px;*/
height: 36px;
margin: 0 50px;
border: 0;
padding: 0;
}
.today-in-history fieldset legend .today-date{
float: left;
display: block;
width: 36px;
height: 100%;
margin: 0 auto;
border: 0;
padding: 0;
line-height: 18px;
border-radius: 5px;
overflow: hidden;
}
.today-in-history fieldset legend .today-date .month{
display: block;
width: 100%;
height: 50%;
margin: 0;
border: 0;
padding: 0;
font-size: 12px;
text-align: center;
color: #fff;
background: #c10e0e;
}
.today-in-history fieldset legend .today-date .day{
display: block;
width: 100%;
height: 50%;
margin: 0;
border: 0;
padding: 0;
text-align: center;
font-size: 12px;
font-weight: bold;
color: #000;
background: #eee;
}
.today-in-history fieldset legend h3{
display: inline-block;
width: auto;
height: 40px;
margin: 0;
border: 0;
padding: 0 10px;
line-height: 40px;
font-size: 18px;
background: none;
}
.today-in-history fieldset ul{
width: auto;
height: auto;
margin: 15px 20px;
border: 0;
padding: 0;
}
.today-in-history fieldset ul li label{
margin: 0 5px;
border: 0;
padding: 0;
}
放到/inc/functions/zib-single.php中的文章底部版权申明下面,引用代码就一行:
today_in_history();
文件路径:zibll/inc/functions/zib-header.php
<div class="huliku_hang"></div>
CSS代码
/*悬挂开始*/
@keyframes lampLine-38cc6824 {
0% {
transform: rotate(10deg)
}
to {
transform: rotate(-10deg)
}
}
.huliku_hang {
width: 170px;
height: 170px;
display: inline-block;
background: url(https://www.daenyx.com/mh/img/zhuti/2024_long.webp) no-repeat 50%/100%;
vertical-align: middle;
position: absolute;
left: 80%;
top: 45px;
z-index: 50;
cursor: pointer;
animation: lampLine-38cc6824 1.2s ease-in-out 0s infinite alternate;
margin-left: -1px;
transform-origin: 50% 0;
pointer-events:none;
}
/*狐狸库悬挂结束*/
zibll主题设置 >> 全局功能 >> 自定义代码 >> 自定义底部HTML代码
zibll主题设置 >> 全局功能 >> 自定义代码 >> 自定义CSS代码
zibll主题设置 >> 全局功能 >> 自定义代码 >> 自定义Javascript代码
<!-- * @Description : 自定义侧边悬浮按钮-->
<div class="huliku-float">
<div class="huliku-float-box">
<div class="huliku-float-item activity">
<a href="/user/rebate">
<img src="/mh/img/quanzhan/xuanfu/zbfox-follow-activity-1.png" alt="activity" class="a1">
<img src="/mh/img/quanzhan/xuanfu/zbfox-follow-activity-2.png" alt="activity" class="a2">
<div class="popover" style="background: url(/mh/img/quanzhan/xuanfu/zbfox-follow-activity-3.png) no-repeat center/cover;"></div>
</a>
</div>
<div class="huliku-float-item huliku-float-vip">
<a class="vip-buy vip-btn pay-vip" vip-level="2" data-toggle="tooltip" data-placement="top" href="javascript:;" data-original-title="开通会员">
<img src="/mh/img/quanzhan/xuanfu/zbfox-follow-vip.svg" alt="会员">
<p class="text">会员</p>
</a>
</div>
<div class="huliku-float-item">
<a href="javascript:;" class="toggle-theme toggle-radius">
<i class="fa fa-toggle-theme"> </i>
</a>
<p id="themeText" class="text">昼夜</p>
</div>
<div class="huliku-float-item">
<a class="initiate-checkin" href="javascript:;" form-action="user_checkin" ed-text="每日签到">
<img src="/mh/img/quanzhan/xuanfu/zbfox-follow-sign.gif" alt="签到">
<p class="text">签到</p>
</a>
</div>
<div class="huliku-float-item">
<a href="#">
<img src="/mh/img/quanzhan/xuanfu/zbfox-choujiang.svg" alt="抽奖">
<p class="text">抽奖</p>
</a>
</div>
<div class="huliku-float-item huliku-float-service">
<img src="/mh/img/quanzhan/xuanfu/zbfox-kefu.svg" alt="客服">
<p class="text">客服</p>
<div class="huliku-float-service-box">
<div class="tops">
<img src="/mh/img/quanzhan/xuanfu/zbfox-follow-service-qq.png" alt="点击联系站长">
<a href="http://wpa.qq.com/msgrd?v=3&uin=5585397&site=qq&menu=yes" class="topsqq" rel="noreferrer nofollow">点击联系站长</a>
<p>在线时间<br>11:00 - 00:00</p>
</div>
<div class="huliku-float-wx-box">
<div class="boxs">
<p>关注微信公众号</p>
<img src="/mh/img/lxfs/gzh.png" alt="关注微信公众号">
</div>
</div>
<div class="btms">
<em>交流QQ群</em>
<p>630957590</p>
<em>站长邮箱</em>
<span>5585397qq.com</span>
</div>
</div>
</div>
<div class="huliku-float-item huliku-floats hide-on-scroll" id="huliku-floats" style="display: none;">
<a href="javascript:(scrollTo());">
<img src="/mh/img/quanzhan/xuanfu/zbfox-follow-gotop.png" alt="TOP">
<p>TOP</p>
</a>
</div>
</div>
</div>
/* * @Description : 自定义悬浮按钮 * @Url : https://www.huliku.com/ * @Email : ihuliku@qq.com * @Date : 2024-01-18 13:14:52 */ .huliku-float { position: fixed; bottom: 20%; right: 1%; z-index: 999; } .huliku-float-box{ box-shadow: 0 4px 23px rgba(0, 0, 0, 0.08); border-radius: 8px; background: #fff; } .huliku-float .huliku-float-item{ color: rgba(23,23,24,0.8); text-align: center; cursor: pointer; width: 54px; padding-bottom: 10px; box-sizing: initial; align-items: center; display: block; } .huliku-float .huliku-float-item i{ font-size: 22px!important; z-index: 2; position: relative; color: #171718; } .huliku-float .huliku-float-item a{ color: rgba(23,23,24,0.8); font-size: 12px; text-decoration: none; } .huliku-float .huliku-float-item a:hover{ color: var(--primary-color)!important; } .huliku-float .huliku-float-item img{ width: 24px; } .huliku-float .huliku-float-item p.text{ font-size: 12px; margin-top: 5px; } .huliku-float .huliku-float-item:hover p.text{ color: var(--primary-color)!important; } .huliku-float .huliku-float-item.huliku-floats{ display: flex; flex-direction: column; justify-content: center; align-items: center; position: relative; } .huliku-float .activity{ background: transparent; position: relative; height: 128px; padding-bottom: 0; } .huliku-float .activity a{ display: block; } .huliku-float .activity .a1{ width: 100%; height: 100%; border-radius: 7px 7px 0px 0px; } .huliku-float .activity .a2{ position: absolute; bottom: 10px; left: 10px; width: 33px; height: 43px; animation: red-envelope-shake 0.8s linear infinite; transition: all .3s; } @keyframes red-envelope-shake { 0% { transform: rotate(-7deg) } 50% { transform: rotate(7deg) } 100% {transform: rotate(-7deg) } } @keyframes turnX{ 0%{transform:rotateX(0deg);} 100%{transform:rotateX(360deg);} } .huliku-float .activity .popover { position: absolute; width: 251px; height: 128px; right: 0; left: -196px; bottom: 0; display: none; } .huliku-float .activity:hover .popover { display: block; } .huliku-float-box .huliku-float-vip{ background: linear-gradient(10deg,#fedd92,#fef6e1); color: #803300; padding-top: 10px; margin-bottom: 10px; } .huliku-float-box .huliku-float-vip a{ color: #803300!important; } .huliku-float-box .huliku-float-vip:hover p.text{ color: #803300!important; font-weight: 600; } .huliku-float-service{ position: relative; } .huliku-float-service:hover .huliku-float-service-box { display: block; transition: all .3s; } .huliku-float-service-box { display: none; position: absolute; z-index: 999; right: 55px; bottom: 0px; width: 150px; padding: 20px; text-align: center; border-radius: 4px; -webkit-box-shadow: 0 0 3px 1px rgba(0,0,0,.05); box-shadow: 0 0 3px 1px rgba(0,0,0,.05); transition: all .3s; background: #fff; } .huliku-float-service-box .tops{ text-align: center; margin-bottom: 15px; padding-bottom: 10px; border-bottom: 1px solid #edf1f2; } .huliku-float-service-box .tops img{ } .huliku-float-service-box .tops a{ display: block; height: 26px; line-height: 26px; margin: 15px auto 10px auto; border: 1px solid #b5b9bc; font-size: 12px; border-radius: 4px; } .huliku-float-service-box .tops a:hover{ background:#fff0; color: var(--primary-color)!important; border: 1px solid var(--primary-color)!important; } .huliku-float-service-box .tops p{ font-size: 13px; } .huliku-float-service-box .btms{ text-align: center; } .huliku-float-service-box .btms em{ font-size: 14px; color: #5f6575; font-weight: 500; margin-bottom: 10px; height: 20px; line-height: 20px; display: block; } .huliku-float-service-box .btms p{ height: 25px; font-weight: 500; line-height: 25px; font-size: 18px; color: #4775FF; margin-bottom: 10px; display: inline-block; } .huliku-float-service-box .btms span{ height: 25px; line-height: 25px; overflow: hidden; font-size: 12px; color: #FF5151; margin-bottom: 10px; } .huliku-float-wx-box { margin-bottom: 15px; } .huliku-float-wx-box .boxs p{ font-size: 14px; color: #5f6575; font-weight: 500; margin-bottom: 10px; height: 20px; line-height: 20px; } .huliku-float-wx-box .boxs img { width: 100%; height: 100%; display: block; margin-top: 10px; padding: 5px; border: 1px solid var(--border-color); margin: 10px auto 0px auto; } .huliku-float-ma{ position: relative; } .huliku-float-ma:hover .huliku-float-ma-box { display: block; transition: all .3s; } .huliku-float-ma-box { display: none; position: absolute; z-index: 999; right: 54px; bottom: 0px; width: 170px; padding: 10px; text-align: center; border-radius: 4px; -webkit-box-shadow: 0 0 3px 1px rgba(0,0,0,.05); box-shadow: 0 0 3px 1px rgba(0,0,0,.05); transition: all .3s; background: var(--primary-color); } .huliku-float-ma-box i{ display: block; width: 31px; height: 5px; margin: 0 auto 10px; border-radius: 2px; background: #6f96ff; } .huliku-float-ma-box em{ display: block; margin: 10px auto 0; width: 20px; height: 20px; border-radius: 100%; background: #6f96ff; } .huliku-float-ma-box .tops{ padding: 10px; background: #fff; border-radius: 4px; text-align: center; } .huliku-float-ma-box .tops p{ font-size: 12px; color: #5f6575; overflow: hidden; height: 23px; line-height: 23px; } .huliku-float-ma-box .tops img { width: 100%; height: 100%; display: block; margin-top: 10px; margin: 10px auto 0px auto; } @media screen and (max-width: 767px) { .huliku-float { display: none !important; } }
/* * @Description : 自定义悬浮按钮 * @Url : https://www.huliku.com/ * @Email : ihuliku@qq.com * @Date : 2024-01-18 13:14:52 */ jQuery(document).ready(function($) { var $hulikuFloat = $('.huliku-float-item.huliku-floats'); $(window).scroll(function() { if ($(this).scrollTop() > 200) { $hulikuFloat.fadeIn(); } else { $hulikuFloat.fadeOut(); } }); $hulikuFloat.click(function() { $('html, body').animate({ scrollTop: 0 }, 800); return false; }); });
代码路径:/zibi/inc/functions/zib-comments-list.php
//狐狸库评论等级数划定等级开始
$com_n = (int) get_user_comment_count($user_id);
if($com_n<20){
$pllv='<span class="pllv" style="margin-left:2px;" data-toggle="tooltip" data-original-title="评论等级:Lv1">
<img class="img-icon ls-is-cached lazyloaded" src="/mh/img/wenzhang/pinglun/lv1.png"
data-src="/mh/img/wenzhang/pinglun//lv1.png" title="" alt="评论等级:Lv1"></span>';
}elseif($com_n>=20&&$com_n<50){
$pllv='<span class="pllv" style="margin-left:2px;" data-toggle="tooltip" data-original-title="评论等级:Lv2">
<img class="img-icon ls-is-cached lazyloaded" src="/mh/img/wenzhang/pinglun/lv2.png"
data-src="/mh/img/wenzhang/pinglun/lv2.png" title="" alt="评论等级:Lv2"></span>';
}elseif($com_n>=50&&$com_n<120){
$pllv='<span class="pllv" style="margin-left:2px;" data-toggle="tooltip" data-original-title="评论等级:Lv3">
<img class="img-icon ls-is-cached lazyloaded" src="/mh/img/wenzhang/pinglun/lv3.png"
data-src="/mh/img/wenzhang/pinglun/lv3.png" title="" alt="评论等级:Lv3"></span>';
}elseif($com_n>=120&&$com_n<250){
$pllv='<span class="pllv" style="margin-left:2px;" data-toggle="tooltip" data-original-title="评论等级:Lv4">
<img class="img-icon ls-is-cached lazyloaded" src="/mh/img/wenzhang/pinglun/lv4.png"
data-src="/mh/img/wenzhang/pinglun/lv4.png" title="" alt="评论等级:Lv4"></span>';
}elseif($com_n>=250&&$com_n<400){
$pllv='<span class="pllv" style="margin-left:2px;" data-toggle="tooltip" data-original-title="评论等级:Lv5">
<img class="img-icon ls-is-cached lazyloaded" src="/mh/img/wenzhang/pinglun/lv5.png"
data-src="/mh/img/wenzhang/pinglun/lv5.png" title="" alt="评论等级:Lv5"></span>';
}elseif($com_n>=400&&$com_n<600){
$pllv='<span class="pllv" style="margin-left:2px;" data-toggle="tooltip" data-original-title="评论等级:Lv6">
<img class="img-icon ls-is-cached lazyloaded" src="/mh/img/wenzhang/pinglun/lv5.png"
data-src="/mh/img/wenzhang/pinglun/lv6.png" title="" alt="评论等级:Lv6"></span>';
}elseif($com_n>=888){
$pllv='<span class="pllv" style="margin-left:2px;" data-toggle="tooltip" data-original-title="评论等级:Lv7">
<img class="img-icon ls-is-cached lazyloaded" src="/mh/img/wenzhang/pinglun/lv7.png"
data-src="/mh/img/wenzhang/pinglun/lv7.png" title="" alt="评论等级:Lv7"></span>';
};
//<a href="https://a.daenzy.com/" title="更多关于 DaenGAME 的文章" target="_blank">DaenGAME</a>评论数划定等级结束
第一步完成后,接着下面增加如上图所示第二红框处添加如下代码即可。
$user_name .= $pllv;
代码路径:themes/zibll/inc/functions/zib-search.php
<button type="submit" name="" class="btn" style="background: #ff3c56;border: 1px solid #fc3c2d;color:rgb(255, 255, 255);border-radius: 55px;border-bottom-left-radius: 0px;border-top-left-radius: 0px;margin-right: -15px;">站内搜索</button>
把上方代码替换掉源代码。然后在第二红色边框处添加 left-cont
CSS代码
/*首页搜索框美化*/
.left-cont {border: 5px solid rgb(255 255 255 / 30%);border-radius: 45px;padding: 0;font-size: 15px;}.header-slider-search .line-form {background: rgba(255,255,255);}
效果图
代码部署
$widgets_files = array(
'zbfox_festival.php', /*小工具文件名*/
);
foreach ($widgets_files as $file) {
require get_template_directory() . '/zbfox/widgets/' . $file;
}
将上面的代码放到/wp-content/themes/zibll/functions.php
文件或者func.php
文件,都是一样的,看上面的代码,别看懵逼了,我们要明白这个:zbfox_festival.php
这个代码,这个代码就是代表一个小工具的名字,相当于就是用上面的代码调用的,就是如果想加第二个小工具,那就是在zbfox_festival.php
这个代码下面加一行其他小工具的别名,我说的已经很仔细了,不懂问站长
注:附件里面的function.php代码要放,要不然用不了
感谢您的来访,获取更多精彩文章请收藏本站。
① 本网站的文章内容来源于网络,学习研究后请自觉删除,请勿传播,因未及时删除所造成的任何后果责任自负。
② 若您认为「WWW.DAENYX.COM」发布的内容若侵犯到您的权益,请联系站长邮箱:5585397@qq.com 进行删除处理。
③ 本站资源大多存储在云盘,如发现链接失效,请联系我们,我们会第一时间更新。
- 最新
- 最热
只看作者