0,00 $

购物车里没有产品

博客DIY小功能和自定义记录

原始地址:修改优化记录 | 青找 (linguang.me)

 

1、优化 Slider Revolution 插件打开速度

首选进入插件目录:/revslider/admin/views中header.php文件然后找到122和123行中

<script src=“https://player.vimeo.com/api/player.js”></script>
<script src=“https://www.youtube.com/iframe_api”></script>

将此两行代码删除掉,保存。

然后在找到插件目录:/revslider/admin/assets/js/modules中的overview.min.js文件,利用查找:

https://platform.twitter.com/widgets.js

后删除掉即可!修改好后现在打开是不是快了很多呀!希望可以帮助到你

2、新增网站微语

使用子主题文件创建

教程地址:https://m1314.cn/277.html

修改记录:functions.php新增代码

//说说页面
function shuoshuo_custom_init()
{
$labels = array(
‘name’ => ‘说说’,
‘singular_name’ => ‘说说’,
‘add_new’ => ‘发表说说’,
‘add_new_item’ => ‘发表说说’,
‘edit_item’ => ‘编辑说说’,
‘new_item’ => ‘新说说’,
‘view_item’ => ‘查看说说’,
‘search_items’ => ‘搜索说说’,
‘not_found’ => ‘暂无说说’,
‘not_found_in_trash’ => ‘没有已遗弃的说说’,
‘parent_item_colon’ => ,
‘menu_name’ => ‘说说’
);
$args = array(
‘labels’ => $labels,
‘public’ => true,
‘publicly_queryable’ => true,
‘show_ui’ => true,
‘show_in_menu’ => true,
‘query_var’ => true,
‘rewrite’ => true,
‘capability_type’ => ‘post’,
‘has_archive’ => true,
‘hierarchical’ => false,
‘menu_position’ => null,
‘supports’ => array(
‘title’,
‘editor’,
‘author’,
‘comments’
 
)
);
register_post_type(‘shuoshuo’, $args);
}
add_action(‘init’, ‘shuoshuo_custom_init’);

新增说说页面模板:page-shuo.php

<?php
 
/**
* Template Name: 说说/微语
*/
 
get_header(); ?>
 
<style>
body.theme-dark .cbp_tmtimeline::before{background:RGBA(255,255,255,0.06)}ul.cbp_tmtimeline{padding:0}div class.cdp_tmlabel > li .cbp_tmlabel{margin-bottom:0}.cbp_tmtimeline{margin:30px 0 0 0;padding:0;list-style:none;position:relative}.cbp_tmtimeline > li .cbp_tmtime{display:block;max-width:70px;position:absolute}.cbp_tmtimeline > li .cbp_tmtime span{display:block;text-align:right}.cbp_tmtimeline > li .cbp_tmtime span:first-child{font-size:0.9em;color:#bdd0db}.cbp_tmtimeline > li .cbp_tmtime span:last-child{font-size:1.2em;color:#9BCD9B}.cbp_tmtimeline > li:nth-child(odd) .cbp_tmtime span:last-child{color:RGBA(255,125,73,0.75)}div.cbp_tmlabel > p{margin-bottom:0}.cbp_tmtimeline > li .cbp_tmlabel{margin:0 0 45px 65px;background:#24a0f0;color:#fff;padding:.8em 1.2em .4em 1.2em;font-weight:300;line-height:1.4;position:relative;border-radius:5px;transition:all 0.3s ease 0s;box-shadow:0 1px 2px rgba(0,0,0,0.15);cursor:pointer;display:block}.cbp_tmlabel:hover{transform:translateY(-3px);z-index:1;-webkit-box-shadow:0 15px 32px rgba(0,0,0,0.15) !important}.cbp_tmtimeline > li:nth-child(odd) .cbp_tmlabel{background:#7878f0}.cbp_tmtimeline > li:nth-child(odd) .cbp_tmlabel:after{border-right-color:#7878f0}.cbp_tmtimeline > li .cbp_tmlabel:after{right:100%;border:solid transparent;content:” “;height:0;width:0;position:absolute;pointer-events:none;border-right-color:#24a0f0;border-width:10px;top:4px}p.shuoshuo_time{margin-top:10px;border-top:1px dashed #fff;padding-top:5px;font-family:Ubuntu}@media screen and (max-width:65.375em){.cbp_tmtimeline > li .cbp_tmtime span:last-child{font-size:1.2em}}.shuoshuo_author_img img{border:1px solid #ddd;padding:2px;float:left;border-radius:64px;transition:all 1.0s;height:50px}.avatar{-webkit-border-radius:100% !important;-moz-border-radius:100% !important;box-shadow:inset 0 -1px 0 #3333sf;-webkit-box-shadow:inset 0 -1px 0 #3333sf;-webkit-transition:0.4s;-webkit-transition:-webkit-transform 0.4s ease-out;transition:transform 0.4s ease-out;-moz-transition:-moz-transform 0.4s ease-out}.zhuan{transform:rotateZ(720deg);-webkit-transform:rotateZ(720deg);-moz-transform:rotateZ(720deg)}
</style>
 
<div id=“primary” class=“content-area”>
<main id=“main” class=“site-main” role=“main”>
<div class=“cbp_shuoshuo”>
<?php
query_posts(“post_type=shuoshuo & post_status=publish & posts_per_page=-1”);
if (have_posts()) : ?>
<ul class=“cbp_tmtimeline”>
<?php
while (have_posts()) : the_post(); ?>
<li>
<span class=“shuoshuo_author_img”><img src= class=“avatar avatar-48” width=“48” height=“48”></span>
<a class=“cbp_tmlabel” href=“javascript:void(0)”>
<p></p>
<p><?php the_content(); ?></p>
<p></p>
<p class=“shuoshuo_time”><i class=“fa fa-clock-o”></i> <?php the_time(‘Y年n月j日G:i’); ?></p>
</a>
</li>
<?php endwhile;
wp_reset_query();//重置查询
?>
</ul>
<?php
else : ?>
<h3 style=“text-align: center;”>你还没有发表说说噢!</h3>
<p style=“text-align: center;”>赶快去发表你的第一条说说心情吧!</p>
<?php
endif; ?>
</div>
</main><!– #main –>
</div><!– #primary –>
<script type=“text/javascript”>
$(function() {
var oldClass = “”;
var Obj = “”;
$(“.cbp_tmtimeline li”).hover(function() {
Obj = $(this).children(“.shuoshuo_author_img”);
Obj = Obj.children(“img”);
oldClass = Obj.attr(“class”);
var newClass = oldClass + ” zhuan”;
Obj.attr(“class”, newClass);
}, function() {
Obj.attr(“class”, oldClass);
})
})
</script>
<?php
get_footer();

3、添加评论框打字烟花(附地址)

Github项目:https://github.com/disjukr/activate-power-mode

上传文件到服务器,替换文件地址,代码放到主题 footer 文件最前面,或者放入 comments 文件最前面也行

<!–烟花打字特效开始–>
<script src=“文件地址/activate-power-mode.js”></script>
<script>
POWERMODE.colorful = true; /* make power mode colorful,ture 为启用礼花特效*/
POWERMODE.shake = false; /* turn off shake,false 为禁用震动特效*/
document.body.addEventListener(‘input’, POWERMODE);
</script>
<!–烟花打字特效结束–>

4、添加评论框评论文字光波流动渐变动画

示例代码,如下:

本站演示,前往评论输入文字即可体验

 
 
CSS代码:
@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution: .001dpcm) {
.masked{
background-image: -webkit-linear-gradient(left, #147B96, #E6D205 25%, #147B96 50%, #E6D205 75%, #147B96);
-webkit-text-fill-color: transparent;
-webkit-background-clip: text;
-webkit-background-size: 200% 100%;
-webkit-animation: masked-animation 4s infinite linear;
}
}
@-webkit-keyframes masked-animation {
0% { background-position: 0 0;}
100% { background-position: -100% 0;}
}
HTML代码:
<div class=“masked”>
<h4>这是一段可选文字</h4>
</div>
 

需要的可以根据以上代码自行修改到自己网站或者博客任意地方

 

修改wp内存限制

/**修改内存限制**/
define( ‘WP_MEMORY_LIMIT’, ‘256M’ );