网站右上角添加复制弹出样式
- 1.主题设置—>
自定义代码
—>自定义底部 HTML 代码
:,添加以下代码: - 2.其他主题自行添加在主题的 head 或 food 文件底部即可
<!--第二款复制提示开始-->
<script src="https://cdn.jsdelivr.net/gh/1426239465/98dou.cn/fzts/ts.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/1426239465/98dou.cn/fzts/ts.css" />
<script type="text/javascript">
function copy_remind(){
toastr.success("撰文不易,若要转载请务必保留原文链接,谢谢!", "复制成功!");
clear_toastr(1600);
// 动态设置消息提示时间
function clear_toastr(time){
setTimeout(
function(){
toastr.clear();
}, time);
}
}
document.addEventListener("copy",function(e){
if(window.getSelection(0).toString()){
copy_remind(); //若所选文本不为空则显示
}
else{
toastr.info("啊噢...你没还没选择复制的内容呢!", "复制提示");
}
});
</script>
<!--第二款复制提示结束-->
弹窗公告样式代码
有些主题自身就有公告弹窗,但还是有很多模板是不带弹窗功能的,那不管好不好看,弄一个先就完事了
- 1、将下面代码添加知网站 head 或者 food 文件底部即可
- 2、子比主题用户如想添加这种样式,你关闭自带的然后再自定义底部 HTML 代码添加下面代码即可
- 3、修改公告中文字内容即可
<!-- 第一种:弹窗公告开始 -->
<script src="https://cdn.bootcss.com/sweetalert/2.1.0/sweetalert.min.js" ;=""></script>
<script>
swal('通知','欢迎进入万事坞短视去水印系统','success');
</script>
<!-- 第一种:弹窗公告结束 -->
网站添加添加居中复制透明提示框
1.子比主题设置—>自定义代码—>自定义javascript代码:,添加以下代码:
//透明复制提示
// by:万事坞-leohi.top
document.body.oncopy = function() {layer.msg('<p style="font-weight: 700;">【万事坞(leohi.top)】<br>复制成功,若要转载请务必保留原文链接!</p>', function(){});};
2.子比主题设置—>自定义代码—>自定义底部HTML代码,添加以下代码:
<!--透明复制提示开始-->
<!--by:万事坞-leohi.top-->
<script src="https://cdn.bootcss.com/layer/2.3/layer.js"></script>
<!--透明复制提示结束-->
在网站右侧边栏添加和风天气模块
后台设置—>外观—>小工具—>添加自定义 HTML 代码,加到合适侧边栏即可
<!--by:万事坞-leohi.top-->
<div id="he-plugin-standard"></div>
<script>
WIDGET = {
"CONFIG": {
"layout": "2",
"width": "285",
"height": "300",
"background": "1",
"dataColor": "FFFFFF",
"borderRadius": "5",
"key": "3180d3c43e524753ab8bcef69dba023a"
}
}
</script>
<script src="https://widget.qweather.net/standard/static/js/he-standard-common.js?v=2.0"></script>
<!--by:万事坞-leohi.top-->
网站文章底部添加【我也是有底线的+图片】
1、在主题后台设置—自定义 CSS 样式 添加以下代码(第一种):
#percentageCounter{position:fixed; left:0; top:0; height:3px; z-index:99999; background-image: linear-gradient(to right, #339933,#FF6666);border-radius:5px;}
/*by:万事坞-leohi.top*/
/*底部可爱底线提示*/
第二种CSS样式:坞长用的是下面这段,上面第一种好像在显示位置和大小方面有点小问题
/*底部可爱底线提示*/
.lastpagenotice_noticewrap{color:hsla(0, 2.1%, 18.8%, 0.6);}.lastpagenotice_noticewrap img{height:73px; width:88px; margin:0 auto}.lastpagenotice_noticewrap .lastpagenotice_text{display:block; position:absolute; font-size:15px; line-height:20px; top:50%; -webkit-transform:translateY(-50%); -ms-transform:translateY(-50%); transform:translateY(-50%); left:-webkit-calc(50% + 60px); left:calc(50% + 60px)}.lastpagenotice_noticewrap .lastpagenotice_line{width:100%; height:1px; background-color:hsla(0,0%,100%,.05); position:absolute; bottom:0}.app_normal{text-align:center; position:relative}
2、在 zibll 主题目录下,themes/zibll/footer.php 文件中的“第一行”(重要)下面也就是footer class..的上方添加下面的代码:
<!--底部可爱底线提示-->
<div class="app_normal window" style="padding-top:" data-reactroot=""><div class="common_container lastpagenotice_noticewrap"><img src="https://z3.ax1x.com/2021/08/25/hZZUjU.png" data-spm-anchor-id="a2ha1.14919748_WEBHOME_GRAY.0.i1"><div class="lastpagenotice_text" style="color:#6699FF;font-weight:bold;">我也是有底线哒~</div><div class="lastpagenotice_line"></div></div></div>
网站文章页底部添加【@版权声明】两种样式
1、在 zibll 主题设置中—文章&列表—-文章页 处找到,版权声明添加以下代码
2、如不是子比主题,样式可通用,放置在你的主题文章页底部即可
样式一:
<!--网站声明代码样式一 start-->
<div>
<fieldset style=" border: 1.5px dashed #008cff; padding: 10px; border-radius: 5px; line-height: 2em;font-weight: 700;color: var(--key-color);background-color: var(--body-bg-color);">
<legend align="center" style=" margin-bottom: -2px;width: 30%;text-align: center; background-color: #008cff; border-radius: 999px; background-image: linear-gradient(to right, #FFCC99, #FF99CC);border: 1.5px dashed #008cff;" >
版权声明
</legend>
<span class="btn-info btn-xs">1</span> 本网站名称:<span style="color: #3333ff"><span style="color: #09ace2; font-size: 18px"><strong>楊仙森的万事坞</strong></span></span><br />
<span class="btn-info btn-xs">2</span> 本站永久网址:<font color="#09ace2">https://leohi.top</font><br />
<span class="btn-info btn-xs">3</span> 本网站的文章部分内容可能来源于网络,仅供大家学习与参考,如有侵权,请联系站长 QQ<a href="http://wpa.qq.com/msgrd?v=3&uin=4223335&site=qq&menu=yes" target="_blank">4223335</a>进行删除处理。<br />
<span class="btn-info btn-xs">4</span> 本站一切资源不代表本站立场,并不代表本站赞同其观点和对其真实性负责。<br />
<span class="btn-info btn-xs">5</span> 本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报<br />
<span class="btn-info btn-xs">6</span> 本站资源大多存储在云盘,如发现链接失效,请联系我们我们会第一时间更新。<br />
</fieldset>
</div>
<!--网站声明代码样式一 end-->
样式二:
<!--网站声明代码样式二 start-->
<div>
<fieldset
style="
border: 1px dashed #008cff;
padding: 10px;
border-radius: 5px;
line-height: 2em;
color: #6d6d6d;
"
>
<legend
align="center"
style="
width: 30%;
text-align: center;
background-color: #008cff;
border-radius: 5px;
background-image: linear-gradient(to right, #0066FF, #FF99CC); text-align:center;"
"
>
文章版权声明
</legend>
<span class="btn-info btn-xs">1</span> 本网站名称:<span style="color: #3333ff"><span style="color: #09ace2; font-size: 18px"><strong>楊仙森的万事坞</strong></span></span><br />
<span class="btn-info btn-xs">2</span> 本站永久网址:<font color="#09ace2">https://leohi.top</font><br />
<span class="btn-info btn-xs">3</span> 本网站的文章部分内容可能来源于网络,仅供大家学习与参考,如有侵权,请联系站长 QQ<a href="http://wpa.qq.com/msgrd?v=3&uin=4223335&site=qq&menu=yes" target="_blank">4223335</a>进行删除处理。<br />
<span class="btn-info btn-xs">4</span> 本站一切资源不代表本站立场,并不代表本站赞同其观点和对其真实性负责。<br />
<span class="btn-info btn-xs">5</span> 本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报<br />
<span class="btn-info btn-xs">6</span> 本站资源大多存储在云盘,如发现链接失效,请联系我们我们会第一时间更新。<br />
</fieldset>
</div>
<!--网站声明代码样式二 END-->
防止盗用代码禁止 F12 和打开网页控制台快捷键
- 虽然这个功能有些鸡肋,不过是可以避免大部分的快捷键打开网站控制台,要查看你网站的源码还是要费点劲的。
- 网站管理后台-–》子比主题设置—》自定义代码—》自定义底部 HTML 代码,把下面的 css 代码复制粘贴到里面即可。
- 其他主题的话在你的主题目录下的,footer.php文件中下面添加下面的代码:
<!--安全 1 开始-->
<script type="text/javascript">
window.onload = function(){
document.onkeydown = function (){
var e = window.event || arguments[0];
//F12
if(e.keyCode == 123){
return false;
//Ctrl+Shift+I
}else if((e.ctrlKey) && (e.shiftKey) && (e.keyCode == 73)){
return false;
//Shift+F10
}else if((e.shiftKey) && (e.keyCode == 121)){
return false;
//Ctrl+U
}else if((e.ctrlKey) && (e.keyCode == 85)){
return false;
}
};
document.oncontextmenu = function (){
return false;
}
}
</script>
<!--安全 1 结束-->
方法 二:不要扒我了
网站管理后台-–》子比主题设置—》自定义代码—》自定义底部 HTML 代码,把下面的 css 代码复制粘贴到里面即可。 其他主题的话在你的主题目录下的,footer.php文件中下面添加下面的代码:
<!--安全 2 不要扒我了开始-->
<script type="text/javascript">
((function() {
var callbacks = [],
timeLimit = 50,
open = false;
setInterval(loop, 1);
return {
addListener: function(fn) {
callbacks.push(fn);
},
cancleListenr: function(fn) {
callbacks = callbacks.filter(function(v) {
return v !== fn;
});
}
}
function loop() {
var startTime = new Date();
debugger;
if (new Date() - startTime > timeLimit) {
if (!open) {
callbacks.forEach(function(fn) {
fn.call(null);
});
}
open = true;
window.stop();
alert('不要扒我了');
window.location.reload();
} else {
open = false;
}
}
})()).addListener(function() {
window.location.reload();
});
</script>
<!--安全 2 不要扒我了结束-->
在评论输入框中加入【快来说点什么吧!】背景样式
1.子比主题设置—>自定义代码—>自定义 CSS 样式:,添加以下 CSS 代码:
/*评论背景图*/
textarea#comment {background-color:transparent;background:linear-gradient(rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05)),url(https://imgsa.baidu.com/forum/pic/item/d439b6003af33a871f7e3f0e9b5c10385343b597.jpg) 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;}
/*评论背景图*/
文章中自动添加关键词链接,协助收录内页优化
在写文章的时候,发布之前你会设置很多标签,比如模板啊,源码,等等,这些关键词,往往需要搜索才能找到,社长给大家分享这个是只要你的文章中包含了你网站的关键词,就会自动添加超链接,也是更好的协助网站收录优化,提高内页收录
1.将下面的 PHP 代码加入到主题目录下:themes/zibll/functions.php 文件中。
// by 万事坞文章添加关键词链接开始
function wpkj_auto_add_tag_link($content){
$limit = 1; // 设置同一个标签添加几次链接
$posttags = get_the_tags();
if ($posttags) {
foreach($posttags as $tag) {
$link = get_tag_link($tag->term_id);
$keyword = $tag->name;
$cleankeyword = stripslashes($keyword);
$url = '<a target="_blank" href="'.$link.'" title="'.str_replace('%s', addcslashes($cleankeyword, '$'), __('View all posts in %s')).'">'.addcslashes($cleankeyword, '$').'</a>';
$regEx = '\'(?!((<.*?)|(<a.*?)))('. $cleankeyword . ')(?!(([^<>]*?)>)|([^>]*?</a>))\'s';
$content = preg_replace($regEx,$url,$content,$limit);
}
}
return $content;
}
add_filter( 'the_content', 'wpkj_auto_add_tag_link', 1 );
// by 万事坞文章添加关键词链接结束
网站添加一个随机预览文章随便看看功能
- 1、这个功能是和随机预览文章的功能,点击一次更换一次文章
- 2、将下面的 PHP 代码加入到主题目录下:themes/zibll/functions.php 文件中。
- 3、添加完成之后访问:你的域名+/?random,然后可以自己添加在菜单里面
- 4、具体效果可以访问查看:https://leohi.top/?random
// 添加随便看看(BY leohi.top)
function random_postlite() {
global $wpdb;
$query = "SELECT ID FROM $wpdb->posts WHERE post_type = 'post' AND post_password = '' AND post_status = 'publish' ORDER BY RAND() LIMIT 1";
if ( isset( $_GET['random_cat_id'] ) ) {
$random_cat_id = (int) $_GET['random_cat_id'];
$query = "SELECT DISTINCT ID FROM $wpdb->posts AS p INNER JOIN $wpdb->term_relationships AS tr ON (p.ID = tr.object_id AND tr.term_taxonomy_id = $random_cat_id) INNER JOIN $wpdb->term_taxonomy AS tt ON(tr.term_taxonomy_id = tt.term_taxonomy_id AND taxonomy = 'category') WHERE post_type = 'post' AND post_password = '' AND post_status = 'publish' ORDER BY RAND() LIMIT 1";
}
if ( isset( $_GET['random_post_type'] ) ) {
$post_type = preg_replace( '|[^a-z]|i', '', $_GET['random_post_type'] );
$query = "SELECT ID FROM $wpdb->posts WHERE post_type = '$post_type' AND post_password = '' AND post_status = 'publish' ORDER BY RAND() LIMIT 1";
}
$random_id = $wpdb->get_var( $query );
wp_redirect( get_permalink( $random_id ) );
exit;
}
if ( isset( $_GET['random'] ) )
add_action( 'template_redirect', 'random_postlite' );
// 随便看看结束(BY leohi.top)
2023-07-10 18:23:41
进行了更新,某些文章内容具有时效性,若失效或有错误,请在下方留言。
暂无评论内容