首先对后宫学长表示感谢,感谢他开源出如此美妙的主题!同时也要最真诚的感谢此主题最原始的作者fuzzz以及由 蜜汁路易,真的真的非常感谢,感谢开源!!!
接下来进入正题,希望能对此主题不熟悉的你能有一点帮助
[huayang]
>>>首页<<<
*背景*
首页映入眼帘的不同就是高斯模糊,这里我去掉了学长的高斯模糊,因为没有透明这一选项。然后就疯狂地找配置文件,在记忆中这东西应该是由js驱动的,然后打脸了,后来在学长那里留言得知了这是靠css运行O(∩_∩)O哈哈~文件地址:inc/decorate
打开这个文件直接搜索if (akina_option(‘background_style’) == ‘blur’) 这就是配置背景高斯模糊的代码
我的改动:
if (akina_option('background_style') == 'blur') { ?>
body::before {
content: '';
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
will-change: transform;
z-index: -1;
background-image: url('<?php echo get_random_bg_url(); ?>');
background-repeat: no-repeat;
background-position: top right;
background-size: cover;
filter: brightness(80%);
}
删除了高斯模糊同时把画面亮度降低了20%以方便字体的呈现
如何只设一张背景图呢
首页背景
后台背景
改后台高斯模糊
把方框里的去掉就行了
暂时就改成这样,下面咱们从上到下来说说改动的部分
*菜单*
菜单可谓是下了我几天的心血,对,就这个看似很简单的东西其实异常麻烦
就拿我的来说
映入眼帘的就是矢量图标的设置,矢量图标嘛首先想到的就是阿里巴巴的图标库“iconfont”,
这东西刚开始搞的时候根本没在意不就是在文字前面加一个图片链接吗
woc一加上去简直千奇百怪,图标和文字的间隔简直吓人
度娘很久一直在想把矢量图转成代码的样子然后添加
搞了很久越看越麻烦,哎,心态崩了
终于还是厚着脸皮在群里问出来了
===重点===
在厚着脸皮的追问下竟打开了宝藏
第一次知道了还有如此丝滑简介的矢量图Font Awesome
如何配置到我的wordpress里呢
- 把安装包解压下来传到网站的根目录
- 在你感觉能插入html代码的地方插入加载代码
<link rel="stylesheet" href="https://hellohy.top/wp-content/themes/H-Siren-master/font-awesome/css/font-awesome.min.css">
根据个人实际位置改动
我直接往菜单冲哈哈,后面就不用多说了吧有图,有官网教程应该会了
++问题++
其实原本并没有问题,在写本文章的时候竟然发现了
上图
百度过后猜想应该是因为字体原因引起的,恰巧写本文时去学长的博客看了看,加了一些css代码
所以同学们没有找到完美解决办法前千万别加此代码!
我们继续说菜单,排列方式上图已给,只不过学长给的模板只有四个
我们怎么才能实现我们想要的功能呢
这里说说我的设置
- 【首页】 这个没啥问题
- 【时间线】这个是使用的学长的
归档
模板 - 【分类】学长没有这个模板,如何使用分类
解决方法
还是新建一个页面,模板默认,在页面里写超链,把分类目录全部添加上去
对了这里还有一个改超链的颜色
这部分代码在style.css文件里,直接搜.entry-content a {即可,代码如下
.entry-content a {
color: #00FFFF;
/* text-decoration: underline; */
}
在此代码下面的便是css选择器就是当鼠标移动到超链显示的颜色,这里可自行更改
因为这东西只显示一个分类,所以添加的时候我们需要去试
超链后面都是这个样的?cat=4
改数字一个个的去试
啊,感觉讲得太啰嗦了
这里还有个头像显示的问题咱们统一放在下面的文章部分里说
后面的【资源分享】链接也同理,在后面的也不用多说了
往下就是一个滚动文字的效果,代码如下:
<span style="color:#FF69B4;font-weight:bold">如有图片未加载的情况请刷新一下,希望此站的文章对您有帮助ヾ(^∀^)ノ 2020.6.19</span>
这里我还没想通,为什么文字会滚动,有懂的同学可以在下方留言说一下
html文字滚动标签是<marquee>
聚焦图
新增代码变为在新窗口打开
首先主题设置改pjax加载
添加代码
*回到顶部*
学长的原图是黑色的,如果关闭高斯模糊背景图又是很深色的情况那这个会到顶部将会很难分辨出来所以我特意制作了一张在任何情况下都很醒目的图
文件:在style.css文件下搜索gotop即可
无论深浅表现都比较不错
图片地址:https://hellohy.top/wp-content/themes/H-Siren-master/images/gotop.png
想到宅男比较多我还制作了一个粉色的:https://hellohy.top/wp-content/themes/H-Siren-master/images/gotop2.png
表现力要稍微差一点点哈哈开心就好,如有其它颜色需要就和我联系把
我们继续来到页面的最下面
学长并没有提供icp备案的图标,并且在icp备案号填写框里竟然不可以引用图标
所以我把这部分代码写在页脚信息里
<img srcb64="https://hellohy.top/icp.png" />蜀ICP备 20020830
我们再往下来到网站运行时间
首先你要开启这个功能
这部分的代码在文件footer.php里面
我的改动
<link rel="stylesheet" href="https://hellohy.top/wp-content/themes/H-Siren-master/font-awesome/css/font-awesome.min.css">
<span style="color:#40E0D0;font-weight: bold"><i class="fa fa-superpowers fa-spin fa-1x fa-fw"></i></span>
<span style="color:#FF69B4;font-weight: bold">网站已在这个世界存在 <?php echo get_web_buildtime(); ?> 天啦</span> <span style="color:#40E0D0;font-weight: bold"><i class="fa fa-superpowers fa-spin fa-1x fa-fw"></i></span>
加了两个图标并改了文字及图标的颜色
选图标的时候除了官网提到的那三个尽量别使用8方位旋转
继续往下,同学们应该都看见下方的歌词了
这是学长写的一个非常综合的一款侧边网页音乐播放插件
*鼠标*
咱们再来说说鼠标
鼠标光标一共分两种形式一个是是普通状态的样式和a:hover(css选择器 超链)的形式
此部分代码可直接加在主题文件下的style.css文件里
/*鼠标样式*/
a:hover{
cursor:url("https://hellohy.top/4.png"),auto;
}
body {
cursor:url("https://hellohy.top/1.png"),auto;
}
这个鼠标是我用美图秀秀二次创作的哈哈哈哈哈
具体的使用方法可以参考这篇文章:https://www.cnblogs.com/SingleWalker/p/7457735.html
想和我一样的也可以直接写我的链接
警告:图标不限与文件形式,但大小切勿超过100×100
看我的引用是png格式一样可行,他可能是图像过大无法显示从而认定png格式不行,因为转格式都会自动缩小到相应标准,比如ico格式,同学们一定要记住,这可是我一下午的成果5555555~
你知道那种明明跟着教程一步一步的做刷新了一下午什么都没有的感觉吗,难受太难受了5555~
下面是鼠标点击特效,学长的感觉有点花哨,找了很久,他这个是根据框架来写的有些东西实在看不懂索性就直接添加了一行js代码
文件地址:/js/app.js
//鼠标点击特效
!function (e, t, a) {function r() {for (var e = 0; e < s.length; e++) s[e].alpha <= 0 ? (t.body.removeChild(s[e].el), s.splice(e, 1)) : (s[e].y--, s[e].scale += .004, s[e].alpha -= .013, s[e].el.style.cssText = "left:" + s[e].x + "px;top:" + s[e].y + "px;opacity:" + s[e].alpha + ";transform:scale(" + s[e].scale + "," + s[e].scale + ") rotate(45deg);background:" + s[e].color + ";z-index:99999");requestAnimationFrame(r)}function n() {var t = "function" == typeof e.onclick && e.onclick;e.onclick = function (e) {t && t(), o(e)}}function o(e) {var a = t.createElement("div");a.className = "heart", s.push({el: a,x: e.clientX - 5,y: e.clientY - 5,scale: 1,alpha: 1,color: c()}), t.body.appendChild(a)}function i(e) {var a = t.createElement("style");a.type = "text/css";try {a.appendChild(t.createTextNode(e))} catch (t) {a.styleSheet.cssText = e}t.getElementsByTagName("head")[0].appendChild(a)}function c() {return "rgb(" + ~~(255 * Math.random()) + "," + ~~(255 * Math.random()) + "," + ~~(255 * Math.random()) + ")"}var s = [];e.requestAnimationFrame = e.requestAnimationFrame || e.webkitRequestAnimationFrame || e.mozRequestAnimationFrame || e.oRequestAnimationFrame || e.msRequestAnimationFrame || function (e) {setTimeout(e, 1e3 / 60)}, i(".heart{width: 10px;height: 10px;position: fixed;background: #f00;transform: rotate(45deg);-webkit-transform: rotate(45deg);-moz-transform: rotate(45deg);}.heart:after,.heart:before{content: '';width: inherit;height: inherit;background: inherit;border-radius: 50%;-webkit-border-radius: 50%;-moz-border-radius: 50%;position: fixed;}.heart:after{top: -5px;}.heart:before{left: -5px;}"), n(), r()}(window, document);
差不多首页能看见的东西咱们就搞定了,下面进入文章页
*文章*
首先文章置顶插件SM STICKY CLICKY STAR,下载地址:https://hellohy.top/chajian/sm-sticky-clicky-star.zip
这东西十分轻便好用
文章还要用到一个PURE HIGHLIGHTJS插件,主要用于代码高亮,记得在主题设置里打开
这里怎么来到一个很棘手的头像的问题
首先安装一个插件WP USER AVATAR地址:https://hellohy.top/chajian/wp-user-avatar.2.2.7%20(1).zip这个主要是用来显示头像的插件,因为wordpress自带的头像设置被墙了,要引用本地图片目前就觉得这个插件不错
咱们来看看评论区,这个也是个重点
==文章评论==
评论区的一大难点就是用户头像问题,这个超级有难度,这个问题貌似学长的博客也一样,貌似做得更差
首先我们要知道wordpress用户头像默认用的是Gravatar的头像,而Gravatar这东西是墙外的东西所以头像不显示最本质的原因就是无法加载
所以最简单的办法就是挂CDN缓存,这里推荐七牛
将下列代码放在主题的function.php文件就行了
//评论用户头像加载
function avatar_cache ($avatar) {
$avatar = str_replace(array("http://www.gravatar.com","http://0.gravatar.com","http://1.gravatar.com","http://2.gravatar.com"),"http://avatar1.qiniudn.com",$avatar);
return $avatar;
}
add_filter( 'get_avatar', 'avatar_cache', 10, 3 );
解决了头像(不完全解决)的问题我们再来看看邮件提醒的问题
目前我是用的还是qq邮箱的邮件进行发送
先上代码
//使用 smtp 发邮件
add_action('phpmailer_init', 'fanly_mail_smtp');
function fanly_mail_smtp( $phpmailer ) {
$phpmailer->IsSMTP();
$phpmailer->SMTPAuth = true;//启用 SMTPAuth 服务
$phpmailer->Port = 465;//SMTP 邮件发送端口,这个和下面的 SSL 验证对应,如果这里填写 25,则下面参数为空
$phpmailer->SMTPSecure ="ssl";//是否验证 ssl,与 MTP 邮件发送端口对应,如果不填写,则上面的端口须为 25
$phpmailer->Host = "smtp.qq.com";//邮箱的 SMTP 服务器地址,目前 smtp.qq.com 为 QQ 邮箱 SMTP
$phpmailer->Username = "[email protected]";//你的邮箱地址
$phpmailer->Password ="***************";//以前是邮箱登录密码,现在是一个授权码
}
//发件地址记得和 smtp 邮箱一致即可
add_filter( 'wp_mail_from', 'fanly_wp_mail_from' );
function fanly_wp_mail_from() {
return '[email protected]';
把以上代码写入function.php文件即可
如果是qq邮箱$phpmailer->Password在以下获取
设置->账号,打开如下图的按钮你会获得一个码,填上就可以使用了
然后我们来看看站长标识的问题
原主题的标识不够突出,色彩对比不是很棒,感觉没啥趣味性,所以就简改一下
文件位置:文字:function.php搜索esc_attr_e(‘Author’, ‘akina’); ?>”>即可到达。颜色:style.css搜索.comment .isauthor即可
颜色部分代码:
.comment .isauthor {
display: none;
font-size: 12px;
line-height: 22px;
color: #FFFFFF;
text-transform: uppercase;
background: #32CD32;
border-radius: 3px;
padding: 0px 3px;
vertical-align: bottom;
}
自我感觉这样要爽很多
最后是留言动图,直接贴上,需要的自取:https://hellohy.top/wp-content/themes/H-Siren-master/images/comment_bg.webp
接下来咱们再来看看菜单部分的设置
请各位同学按下F12看看我老婆( ̄ε(# ̄)☆╰╮( ̄▽ ̄///)
*彩蛋*
这里我删除了学长以及
这些,抱歉哈,
首先说说这些在哪里改
先说上图
最上面那两个是远程文件所以不好搞得,我们只搞本地的
位置:\H-Siren-master\live2d\js\live2d.js和\H-Siren-master\live2d\js\message.js
一打开,卧槽,这个框架有点搞心态
不怕咱们美化一下
地址:https://www.html.cn/tool/js_beautify/
After a long time~
兄弟们别改了,会崩的5555~~
咱不管浪多先把自己的搞上去了再说
文件地址:/js/app.js直接搜索:$(function() { 拉到下面看见学长写的改了就行
代码:
//彩蛋
var svgbiz = '<svg xmlns="http://www.w3.org/2000/svg" width="320" height="320" fill="none" stroke="#000" stroke-linecap="round" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><path id="b"><animate id="a" attributeName="d" values="m160,160l0,0 0,0;m130,110l30,-17 30,17;m130,60l30,-17 30,17;m160,20l0,0 0,0" dur="6s" repeatCount="indefinite"/><animate attributeName="stroke-width" values="0;4;4;4;0" dur="6s" repeatCount="indefinite" begin="a.begin"/></path><path id="c"><animate attributeName="d" values="m160,160l0,0 0,0;m130,110l30,-17 30,17;m130,60l30,-17 30,17;m160,20l0,0 0,0" dur="6s" repeatCount="indefinite" begin="a.begin+1s"/><animate attributeName="stroke-width" values="0;4;4;4;0" dur="6s" repeatCount="indefinite" begin="a.begin+1s"/></path><path id="d"><animate attributeName="d" values="m160,160l0,0 0,0;m130,110l30,-17 30,17;m130,60l30,-17 30,17;m160,20l0,0 0,0" dur="6s" repeatCount="indefinite" begin="a.begin+2s"/><animate attributeName="stroke-width" values="0;4;4;4;0" dur="6s" repeatCount="indefinite" begin="a.begin+2s"/></path><path id="e"><animate attributeName="d" values="m160,160l0,0 0,0;m130,110l30,-17 30,17;m130,60l30,-17 30,17;m160,20l0,0 0,0" dur="6s" repeatCount="indefinite" begin="a.begin+3s"/><animate attributeName="stroke-width" values="0;4;4;4;0" dur="6s" repeatCount="indefinite" begin="a.begin+3s"/></path><path id="f"><animate attributeName="d" values="m160,160l0,0 0,0;m130,110l30,-17 30,17;m130,60l30,-17 30,17;m160,20l0,0 0,0" dur="6s" repeatCount="indefinite" begin="a.begin+4s"/><animate attributeName="stroke-width" values="0;4;4;4;0" dur="6s" repeatCount="indefinite" begin="a.begin+4s"/></path><path id="g"><animate attributeName="d" values="m160,160l0,0 0,0;m130,110l30,-17 30,17;m130,60l30,-17 30,17;m160,20l0,0 0,0" dur="6s" repeatCount="indefinite" begin="a.begin+5s"/><animate attributeName="stroke-width" values="0;4;4;4;0" dur="6s" repeatCount="indefinite" begin="a.begin+5s"/></path></defs><use xlink:href="#b"/><use xlink:href="#b" transform="rotate(60 160 160)"/><use xlink:href="#b" transform="rotate(120 160 160)"/><use xlink:href="#b" transform="rotate(180 160 160)"/><use xlink:href="#b" transform="rotate(240 160 160)"/><use xlink:href="#b" transform="rotate(300 160 160)"/><use xlink:href="#c" transform="rotate(30 160 160)"/><use xlink:href="#c" transform="rotate(90 160 160)"/><use xlink:href="#c" transform="rotate(150 160 160)"/><use xlink:href="#c" transform="rotate(210 160 160)"/><use xlink:href="#c" transform="rotate(270 160 160)"/><use xlink:href="#c" transform="rotate(330 160 160)"/><use xlink:href="#d"/><use xlink:href="#d" transform="rotate(60 160 160)"/><use xlink:href="#d" transform="rotate(120 160 160)"/><use xlink:href="#d" transform="rotate(180 160 160)"/><use xlink:href="#d" transform="rotate(240 160 160)"/><use xlink:href="#d" transform="rotate(300 160 160)"/><use xlink:href="#e" transform="rotate(30 160 160)"/><use xlink:href="#e" transform="rotate(90 160 160)"/><use xlink:href="#e" transform="rotate(150 160 160)"/><use xlink:href="#e" transform="rotate(210 160 160)"/><use xlink:href="#e" transform="rotate(270 160 160)"/><use xlink:href="#e" transform="rotate(330 160 160)"/><use xlink:href="#f"/><use xlink:href="#f" transform="rotate(60 160 160)"/><use xlink:href="#f" transform="rotate(120 160 160)"/><use xlink:href="#f" transform="rotate(180 160 160)"/><use xlink:href="#f" transform="rotate(240 160 160)"/><use xlink:href="#f" transform="rotate(300 160 160)"/><use xlink:href="#g" transform="rotate(30 160 160)"/><use xlink:href="#g" transform="rotate(90 160 160)"/><use xlink:href="#g" transform="rotate(150 160 160)"/><use xlink:href="#g" transform="rotate(210 160 160)"/><use xlink:href="#g" transform="rotate(270 160 160)"/><use xlink:href="#g" transform="rotate(330 160 160)"/></svg>';
var cssbiz = 'background: url(\'data:image/svg+xml;utf8,' + svgbiz + '\') left top no-repeat; font-size: 260px;';
window.console.log("%c哟,骚年,又来扒代码啦~", "color:red;font-size:30px");
window.console.log("%c↓老婆们嘿嘿(´^ω^`)↓", "color:Pink;font-size:40px");
console.log("%c ", "background: url(https://hellohy.top/img/asd.jpg) no-repeat center;padding-left:420px;padding-bottom: 250px;")
window.console.log('%c ', cssbiz);
window.console.error("%c动画彩蛋目前仅支持2345浏览器!!!", "color:orange;font-size:30px")
window.console.log("%c动画彩蛋预览请移步:https://hellohy.top/caidan/","color:purple;font-size:20px")
});
根据自己酌情添加
这首页的部分就大概完成了
咱们再来看看后端的问题
>>>后端&问题<<<
*百度收录*
文件地址:HEADER.PHP
<!--百度收录-->
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.srcb64 = "https://hm.baidu.com/hm.js?c9677f1cf79ebed947554bb1c82a84e8";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
参考文章:https://www.cnblogs.com/chinafine/articles/9359814.html
*强制转换https*
这个可是重中之重
同学们都端板凳给我做好
都给我认真听!!!
先口水话一波
我的这个网站是托管在百度云的,所以备案号没下来的时候就是用的是百度云临时地址在做网页百度云给的临时地址自然是没有ssl的
所以当备案号下来的时候我接入ssl我当场就傻了
你知道没有css的界面是什么感觉吗,然后就是一大堆的这个
解决办法首先在后台改成https
如果后台已经崩了就去数据库里改
全部改成https就行了
接下来进入FXP里找到wp-config.php文件写入下列代码
$_SERVER[\'HTTPS\'] = \'on\';
define(\'FORCE_SSL_LOGIN\', true);
define(\'FORCE_SSL_ADMIN\', true);
这个设置好基本上就可以打开后台了
这下我们再来到function.php文件复制下列代码
//强制转换https
add_filter('script_loader_srcb64', 'agnostic_script_loader_srcb64', 20,2);
function agnostic_script_loader_srcb64($srcb64, $handle) {
return preg_replace('/^(http|https):/', '', $srcb64);
}
add_filter('style_loader_srcb64', 'agnostic_style_loader_srcb64', 20,2);
function agnostic_style_loader_srcb64($srcb64, $handle) {
return preg_replace('/^(http|https):/', '', $srcb64);
}
这样就大功告成了!!!ohohohohohoh!!!
最后的最后再推荐一款插件把:ALL IN ONE WP SECURITY
下载地址:https://hellohy.top/chajian/all-in-one-wp-security-and-firewall%20(2).zip
啊啊啊!从昨天下午吃了饭写到现在16.44,脖子好酸呀
2020.7.16更
友链
说一下友链怎么搞
1.首先要添加分类
2.添加链接信息
2020.8.31更
这次主要增加了页面的雪花和主页面自动播放音乐
雪花
把以下代码放置在/js/app.js内
如需自行设置请参照:https://github.com/kujian/xmas-snow
提供几种雪花样式:*、✽、✲、✻、✼、❄、❅、❆
//雪花
/**
* xmas-snow
* @author caibaojian
* @site http://caibaojian.com
* @github https://github.com/kujian/xmas-snow
* @demo http://caibaojian.com/demo/2016/10/snow.html
* @license MIT
*/
/**
* @param {Object} [options]
*
* usage:
*
* var snow = new Snow({
snowmax:50,
snowcolor:["#FFDA65", "#00AADD", "#aaaacc", "#ddddff", "#ccccdd", "#f3f3f3", "#f0ffff", "#bbf7f9"],
snowtype:["Times", "Arial", "Times", "Verdana"],
snowletter:"*",
sinkspeed: 0.6,
snowmaxsize:30,
snowminsize:8,
snowingzone:1
});
*/
(function SnowModule(factory) {
"use strict";
if (typeof define === "function" && define.amd) {
define(factory);
} else if (typeof module != "undefined" && typeof module.exports != "undefined") {
module.exports = factory();
} else if (typeof Package !== "undefined") {
//noinspection JSUnresolvedVariable
Snow = factory(); // export for Meteor.js
} else {
/* jshint sub:true */
window["Snow"] = factory();
}
})(function SnowFactory() {
"use strict";
function Snow(option) {
option = option || {};
// Set the number of snowflakes (more than 30 - 40 not recommended)
this.snowmax = option.snowmax || 100;
// Set the colors for the snow. Add as many colors as you like
this.snowcolor = option.snowcolor || new Array("#FFDA65", "#00AADD", "#aaaacc", "#ddddff", "#ccccdd", "#f3f3f3", "#f0ffff", "#bbf7f9");
// Set the fonts, that create the snowflakes. Add as many fonts as you like
this.snowtype = option.snowtype || new Array("Times", "Arial", "Times", "Verdana");
// Set the letter that creates your snowflake (recommended: * )
this.snowletter = option.snowletter || "❄";
// Set the speed of sinking (recommended values range from 0.3 to 2)
this.sinkspeed = option.sinkspeed || 0.6;
// Set the maximum-size of your snowflakes
this.snowmaxsize = option.snowmaxsize || 30;
// Set the minimal-size of your snowflakes
this.snowminsize = option.snowminsize || 8;
// Set the snowing-zone
// Set 1 for all-over-snowing, set 2 for left-side-snowing
// Set 3 for center-snowing, set 4 for right-side-snowing
this.snowingzone = option.snowingzone || 1;
this.showSnow = option.showSnow !== undefined ? option.showSnow : true;
///////////////////////////////////////////////////////////////////////////
this.snow = new Array();
this.marginbottom;
this.marginright;
this.timer;
this.i_snow = 0;
this.x_mv = new Array();
this.crds = new Array();
this.lftrght = new Array();
this.browserinfos = window.navigator.userAgent;
this.ie5 = document.all && document.getElementById && !this.browserinfos.match(/Opera/);
this.ns6 = document.getElementById && !document.all;
this.opera = this.browserinfos.match(/Opera/);
this.browserok = this.ie5 || this.ns6 || this.opera;
//start snow
if(this.showSnow) this.startSnow();
}
Snow.prototype.randommaker = function(range) {
var rand = Math.floor(range * Math.random());
return rand;
}
Snow.prototype.initsnow = function() {
if (this.ie5 || this.opera) {
this.marginbottom = document.body.scrollHeight;
this.marginright = document.body.clientWidth - 15;
} else if (this.ns6) {
this.marginbottom = document.body.scrollHeight;
this.marginright = window.innerWidth - 15;
}
this.snowsizerange = this.snowmaxsize - this.snowminsize;
for (var i = 0; i <= this.snowmax; i++) {
this.crds[i] = 0;
this.lftrght[i] = Math.random() * 15;
this.x_mv[i] = 0.03 + Math.random() / 10;
this.snow[i] = document.getElementById("s" + i);
this.snow[i].style.fontFamily = this.snowtype[this.randommaker(this.snowtype.length)];
this.snow[i].size = this.randommaker(this.snowsizerange) + this.snowminsize;
this.snow[i].style.fontSize = this.snow[i].size + 'px';
this.snow[i].style.color = this.snowcolor[this.randommaker(this.snowcolor.length)];
this.snow[i].style.zIndex = 1000;
this.snow[i].sink = this.sinkspeed * this.snow[i].size / 5;
if (this.snowingzone == 1) {
this.snow[i].posx = this.randommaker(this.marginright - this.snow[i].size)
}
if (this.snowingzone == 2) {
this.snow[i].posx = this.randommaker(this.marginright / 2 - this.snow[i].size)
}
if (this.snowingzone == 3) {
this.snow[i].posx = this.randommaker(this.marginright / 2 - this.snow[i].size) + this.marginright / 4
}
if (this.snowingzone == 4) {
this.snow[i].posx = this.randommaker(this.marginright / 2 - this.snow[i].size) + this.marginright / 2
}
this.snow[i].posy = this.randommaker(2 * this.marginbottom - this.marginbottom - 2 * this.snow[i].size);
this.snow[i].style.left = this.snow[i].posx + 'px';
this.snow[i].style.top = this.snow[i].posy + 'px';
}
this.movesnow();
}
Snow.prototype.movesnow = function() {
for (var i = 0; i <= this.snowmax; i++) {
this.crds[i] += this.x_mv[i];
this.snow[i].posy += this.snow[i].sink;
this.snow[i].style.left = this.snow[i].posx + this.lftrght[i] * Math.sin(this.crds[i]) + 'px';
this.snow[i].style.top = this.snow[i].posy + 'px';
if (this.snow[i].posy >= this.marginbottom - 2 * this.snow[i].size || parseInt(this.snow[i].style.left) > (this.marginright - 3 * this.lftrght[i])) {
if (this.snowingzone == 1) {
this.snow[i].posx = this.randommaker(this.marginright - this.snow[i].size)
}
if (this.snowingzone == 2) {
this.snow[i].posx = this.randommaker(this.marginright / 2 - this.snow[i].size)
}
if (this.snowingzone == 3) {
this.snow[i].posx = this.randommaker(this.marginright / 2 - this.snow[i].size) + this.marginright / 4
}
if (this.snowingzone == 4) {
this.snow[i].posx = this.randommaker(this.marginright / 2 - this.snow[i].size) + this.marginright / 2
}
this.snow[i].posy = 0;
}
}
var that = this;
this.snowTimer = window.setTimeout(function() {
that.movesnow();
},
50);
}
Snow.prototype.createSnow = function() {
var body = document.getElementsByTagName('body')[0],
fragment = document.createElement('div'),
_html='';
for (var i = 0; i <= this.snowmax; i++) {
_html+='<span id="s'+ i +'" style="position:absolute;top:-'+ this.snowmaxsize +'">'+ this.snowletter +'</span>';
}
fragment.innerHTML = _html;
this.fragment = fragment;
body.appendChild(fragment);
}
Snow.prototype.startSnow = function() {
this.createSnow();
if (this.browserok) {
this.initsnow();
}
}
Snow.prototype.removeSnow = function(){
var body = document.getElementsByTagName('body')[0];
body.removeChild(this.fragment);
clearTimeout(this.snowTimer);
this.snowTimer= null;
}
/**
* Create snow instance
* @param {Object} [options]
*/
Snow.create = function(options) {
return new Snow(options);
};
// Export
Snow.version = '1.0.2';
return Snow;
});
var snow = new Snow();
音乐
因为音乐只能在主页播放所以代码不能放置在footer.php或header.php内,当然想全局播放的同学当我没说
所以这次把代码放在页脚信息里
这样主页就可以正常播放音乐而其余页面则会因为路径不对加载失败从而防止播放
<audio srcb64="hdxt.flac" autoplay="autoplay"> </audio>
BGM:傲七爷,小田音乐社 – 回到夏天
我的这里用不起中文,一用就会报错,暂时无解,你们应该没问题
还有不懂的同学可以在评论区留言哦
咱们下次再见吧~
202012.12更
新增评论查看文章权限和登陆查看文章权限
评论
##########评论查看文章权限
function reply_to_read($atts, $content=null) {
extract(shortcode_atts(array("notice" => '<p class="reply-to-read">温馨提示: 以下内容需要<a href="#respond" title="评论本文">评论本文</a>后才能查看.</p>'), $atts));
$email = null;
$user_ID = (int) wp_get_current_user()->ID;
if ($user_ID > 0) {
$email = get_userdata($user_ID)->user_email;
//对博主直接显示内容
$admin_email = "[email protected]"; //博主Email
if ($email == $admin_email) {
return $content;
}
} else if (isset($_COOKIE['comment_author_email_' . COOKIEHASH])) {
$email = str_replace('%40', '[email protected]', $_COOKIE['comment_author_email_' . COOKIEHASH]);
} else {
return $notice;
}
if (empty($email)) {
return $notice;
}
global $wpdb;
$post_id = get_the_ID();
$query = "SELECT `comment_ID` FROM {$wpdb->comments} WHERE `comment_post_ID`={$post_id} and `comment_approved`='1' and `comment_author_email`='{$email}' LIMIT 1";
if ($wpdb->get_results($query)) {
return do_shortcode($content);
} else {
return $notice;
}
}
add_shortcode('huayang', 'reply_to_read');
在要隐藏的内容加上[huayang][/huayang]
登陆
#######################################################################
############################- 登录可见 -##############################
######################################################################
add_shortcode( 'member', 'member_check_shortcode' );
function member_check_shortcode( $atts, $content = null ) {
if ( is_user_logged_in() && !is_null( $content ) && !is_feed() )
return $content;
return '此内容登录可见'; //这里显示未登录的提示信息
}
[member]这里的内容访客是无法看到的[/member]
[/huayang]
FROM:浅浅淡淡[hellohy]
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论