Loading [MathJax]/jax/output/CommonHTML/config.js
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >wordpress优化经历(四)——一把伞的时间轴归档页模板

wordpress优化经历(四)——一把伞的时间轴归档页模板

作者头像
不愿意做鱼的小鲸鱼
发布于 2022-09-26 10:41:39
发布于 2022-09-26 10:41:39
30800
代码可运行
举报
文章被收录于专栏:web全栈web全栈
运行总次数:0
代码可运行

相关资源图片下载

一把伞的时间轴归档页模板文件 链接一:https://download.csdn.net/download/qq_42038623/21072565

链接二:点击下面按钮,提取码: 3d5z

Get it!Download

×

下载提示

请您认真评论后再下载!

知道了

1. 模板图片

将我共享的网盘中的文件夹下的图片存储到当前主题下的assets/images/目录下

2. 保存JS文件

将我共享的网盘中JS模板文件全部保存在网站可直接访问的目录下即可,比如我这里在/var/www/wordpress下面创建一个archive目录,并将JS文件上传进去即可

3. 编写代码

创建一个PHP文件,并保存到文章来源(Source):浅时光博客主题page/目录下;注意修改JS文件的存储URL路径为自己的

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
<?php
/**
 * Template Name: 伞时光轴
 */
get_header();?>
<style>
    /*  外框样式*/
    #footer {
        display: none
    }
    .archives {
        position: relative;
        padding: 200px 0 220px;
        margin-bottom: 10px;
        min-height: calc(100vh - 70px);
        width: 750px;
        left: calc(50% - 375px);
        text-align: center;
        font-family: Georgia, 'Microsoft JhengHei', '微软雅黑';
        background: url(<?php echo get_template_directory_uri()."/assets/sanguidang/images/timebt.png" ?>) no-repeat left 328px bottom 0;
    }
    .diy-logo img {
        position: absolute;
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        border-bottom: 4px solid #86544D;
        max-width: 90vw;
        z-index: 2
    }

    .archives .diy-bt img {
        position: absolute;
        bottom: 0px;
        left: 328px;
        z-index: 9999999999;
    }

    .archives ul {
        margin: 0;
        padding: 0
    }

    .diy-logo:hover {
        cursor: pointer
    }

    .archives>ul>li {
        list-style-type: none;
        position: relative;
        width: 100%;
    }

    .archives li a {
        padding: 8px 0;
        display: inline-block;
        color: #666;
    }
    /*  标题前小圆点在鼠标经过时的样式*/

    .archives li a:hover .sp3 {
        background: #ff5c43;
    }
    /*  日期样式*/

    .archives li a .rq {
        position: absolute;
        left: 275px;
        width: 100px;
        font-size: 14px;
        font-family: times;
    }
    /*  标题*/

    .archives li a .atitle {
        position: absolute;
        left: 388px;
        text-align: left;
    }
    /*  标题前的外围小点*/

    .archives li a .sp4 {
        position: absolute;
        left: 367px;
        background: #86544D;
        height: 16px;
        width: 16px;
        border-radius: 50%;
        top: 10px;
        transition: all .3s
    }
    /*  标题前的小点内围*/

    .archives li a .sp3 {
        position: absolute;
        left: 370px;
        background: #fff;
        height: 10px;
        width: 10px;
        border-radius: 50%;
        top: 13px;
        z-index: 1;
        transition: all .3s
    }
    /*  时间中间线*/

    .archives:before {
        height: calc(100% - 205px);
        width: 4px;
        background: #86544D;
        position: absolute;
        left: 373px;
        content: "";
        top: 50px
    }
    /*  左边月份标题*/

    .m-title {
        position: relative;
        width: 140px;
        top: 10px;
        left: 305px;
        cursor: pointer;
        color: #86544D;
        font-size: 18px;
        border: 4px solid #86544D;
        padding: 3px 0;
        background: #fff;
        border-radius: 20px;
        transition: all .5s;
        font-family: Georgia;
    }
    /*  鼠标经过大圆点样式*/

    .m-title:hover {
        background: #ff5c43!important;
    }

    .diy-card {
        width: 320px;
        position: relative;
        left: 402px;
        top: 16px;
        text-align: left;
        box-shadow: 0 4px 6px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.3);
        transition: all .3s;
        z-index: 3;
    }

    .diy-card:hover .post-img img {
        transform: scale(2);
    }

    .diy-card .post .post-title {
        display: none;
        margin: -4px 0 -12px;
    }

    .diy-card .post-style-card .post-top-meta {
        display: none;
        margin-bottom: 10px;
    }

    .diy-card .post-style-card .post-time {
        margin-top: 10px
    }

    .diy-card .post-style-card .post-img {
        margin: -10px -10px 0;
        overflow: hidden;
        padding: 0
    }

    .diy-card .post-style-card .post-img img {
        transition: all .5s ease-out
    }

    .diy-card .post-style-card .post-bottom {
        padding-top: 0
    }

    .diy-card .post-style-card .post-meta-author {
        margin-bottom: 0
    }

    .diy-card .post-style-card .post-meta-author a span {
        width: auto
    }

    .body-container {
        top: 58px;
        background: url(<?php echo get_template_directory_uri()."/assets/sanguidang/images/bgbottom.png" ?>) no-repeat center bottom 0/contain fixed, url(<?php echo get_template_directory_uri()."/assets/sanguidang/images/bg.png" ?>) no-repeat right 0 top 70px fixed, linear-gradient(90deg, rgba(255, 165, 150, 0.3) 10%, rgba(0, 228, 255, 0.35)) no-repeat !important;
    }

    .bg {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 0
    }

    @media(max-width:767px) {
        .container {
            background: url(<?php echo get_template_directory_uri()."/assets/sanguidang/images/bgbottom.png" ?>) no-repeat center bottom 0/contain fixed, linear-gradient(90deg, rgba(255, 165, 150, 0.3) 10%, rgba(0, 228, 255, 0.35)) no-repeat;
        }
        .diy-card,
        .diy-card .post {
            box-shadow: none;
        }
        .archives {
            width: 100%;
            padding-top: 150px
        }
        .diy-logo img {
            top: 70px
        }
        .archives li a .rq {
            display: none
        }
        .diy-card {
            width: 310px;
            left: 220px
        }
        .diy-card .post-style-card .post-top-meta {
            display: block;
            margin: 0px 4px
        }
        .diy-card .post .post-title {
            display: block;
            margin: 0px 4px -8px;
        }
        .archives li a .atitle {
            display: none
        }
        .diy-card .post-style-card .post-img {
            height: auto;
            max-height: 148px;
            margin: 0px 4px;
            overflow: hidden;
            padding: 0
        }
        .diy-card .post-style-card .post-img img {
            height: auto
        }
    }

    @media(min-width:768px) {
        .m-title:nth-of-type(2n) {
            left: 252px
        }
        .m-title:nth-of-type(2n+1) {
            left: 358px
        }
        .archives li:nth-child(2n) .diy-card {
            left: 28px;
        }
        .archives li:nth-child(2n) .rq {
            left: 376px;
        }
        .archives li:nth-child(2n) .atitle {
            left: 28px;
            text-align: right;
            width: 335px;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
            padding: 0;
        }
    }
</style>
<div class="body-container">
    <?php if (have_posts()): ?>
    <?php while (have_posts()) : the_post(); ?>
    <article class="page-content">
        <?php the_content(); ?>
    </article>
    <?php endwhile;  ?>
    <?php endif; ?>
    <div class="bg">
        <div id="birds-canvas-holder"></div>
    </div>
    <div class="diy-logo"><img src="<?php echo get_template_directory_uri()."/assets/sanguidang/images/time.png " ?>" alt="点击可展开或收缩"></div>
    <div class="archives">
        <?php
        $previous_year = $year = 0;
        $previous_month = $month = 0;
        $ul_open = false;
        $myposts = get_posts( 'numberposts=-1&orderby=post_date&order=DESC' );
        foreach ( $myposts as $post ):
            setup_postdata( $post );
            $year = mysql2date( 'Y', $post->post_date );
            $month = mysql2date('n', $post->post_date );
            $day = mysql2date( 'j', $post->post_date );
            if ( $year != $previous_year || $month != $previous_month ):
            if ( $ul_open == true ):
                echo '</ul>';
            endif;
            echo '<h4 class="m-title">';
            echo the_time( 'Y-m' );
            echo '</h4>';
            echo '<ul class="archives-monthlisting">';
            $ul_open = true;
            endif;
            $previous_year = $year;
            $previous_month = $month;
        ?>
            <li style="min-height: 40px;">
                <a href="<?php the_permalink(); ?>"><span class="rq"><?php the_time('Y-m-j'); ?></span>
                <div class="atitle"><?php the_title(); ?></div><span class="sp3"></span><span class="sp4"></span></a>
                <div class="diy-card">
                    <?php get_template_part('template-parts/post/content-card'); ?>
                </div>
            </li>
            <?php endforeach; ?>
            </ul>
            <div class="diy-bt"><img src="<?php echo get_template_directory_uri()."/assets/sanguidang/images/timebt.png " ?>" alt="点击可展开或收缩"></div>
    </div>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
<script src="/wp-content/themes/niRvana/assets/sanguidang/js/three.min.js"></script>
<script src="/wp-content/themes/niRvana/assets/sanguidang/js/CanvasRenderer.js"></script>
<script src="/wp-content/themes/niRvana/assets/sanguidang/js/Projector.js"></script>
<script src="/wp-content/themes/niRvana/assets/sanguidang/js/TweenMax.min.js"></script>
<script src="/wp-content/themes/niRvana/assets/sanguidang/js/main-0a79fb13e7.min.js"></script>
<script>
    $('.archives ul.archives-monthlisting').hide();
    //$('.archives ul.archives-monthlisting:first' ).show();
    //$('.archives .m-title:first').css('background','#DDC6C4');
    $('.archives .m-title').click(function() {
        $('.archives .m-title').css('background', '#fff');
        $(this).next().fadeToggle('fast');
        $(this).css('background', '#DDC6C4');
        return false;
    });

    $('.diy-logo').on('click', function(e) {
        e.preventDefault();
        if ($(this).data('s')) {
            $(this).data('s', '');
            $('.archives ul.archives-monthlisting').show();
        } else {
            $(this).data('s', 1);
            $('.archives ul.archives-monthlisting').hide();
        }
    });
</script>

4. 新建页面

然后我们登入到WP后台 —> 新建页面 —> 模板选择 伞时光轴

5. 效果展示

查看我的个人博客网站:http://qkongtao.cn/?page_id=962

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
暂无评论
推荐阅读
编辑精选文章
换一批
JRebel插件使用详解
JRebel是一套JavaEE开发工具。 Jrebel 可快速实现热部署,节省了大量重启时间,提高了个人开发效率。 JRebel是一款JAVA虚拟机插件,它使得JAVA程序员能在不进行重部署的情况下,即时看到代码的改变对一个应用程序带来的影响。JRebel使你能即时分别看到代码、类和资源的变化,你可以一个个地上传而不是一次性全部部署。当程序员在开发环境中对任何一个类或者资源作出修改的时候,这个变化会直接反应在部署好的应用程序上,从而跳过了构建和部署的过程,可以省去大量的部署用的时间。
全栈程序员站长
2022/06/27
2.9K0
JRebel插件使用详解
JRebel 热部署插件的安装使用
  当你修改doGet,doPost等一些内容时,你再次访问,访问到的内容不变,除非重启或重新加载class文件。 用Jrebel 可快速实现热部署,节省了大量重启时间,提高了个人开发效率。
全栈程序员站长
2022/08/31
1.2K0
JRebel 热部署插件的安装使用
IntelliJ IDEA激活码,绝对有效!(2022年最新永久激活码)
大家可以关注微信公众号:Java团长,然后发送“ 激活码 ”即可获取最新有效的IDEA激活码哈~
Java团长
2018/08/03
13.9K0
热部署JRebel的使用
JRebel是一套JavaEE开发工具。JRebel允许开发团队在有限的时间内完成更多的任务修正更多的问题,发布更高质量的软件产品。 JRebel是收费软件,用户可以在JRebel官方站点下载30天的评估版本。
全栈程序员站长
2022/08/26
1.2K0
热部署JRebel的使用
IDEA热部署插件JRebel
这里使用离线安装方式,在idea中点击file->settings,再点击plugins->install plugin from disk,选择JRebel插件的离线安装文件,点击确定后重启idea。
KEN DO EVERTHING
2019/01/17
1.9K0
在Intellij IDEA中如何使用Debug!
Debug用来追踪代码的运行流程,通常在程序运行过程中出现异常,启用Debug模式可以分析定位异常发生的位置,以及在运行过程中参数的变化。通常我们也可以启用Debug模式来跟踪代码的运行流程去学习三方框架的源码。
Java3y
2019/05/21
5.3K0
在Intellij IDEA中如何使用Debug!
Spring Boot 使用JRebel实现热部署
Spring Boot中的热部署相信大家用的最多的就是devtools,没办法,官推的。
爱撒谎的男孩
2020/11/04
4.7K0
Spring Boot 使用JRebel实现热部署
Idea配置热部署「建议收藏」
热部署就是正在运行状态的应用,修改了他的源码之后,在不重新启动的情况下能够自动把增量内容编译并部署到服务器上,使得修改立即生效。热部署为了解决的问题有两个, 一是在开发的时候,修改代码后不需要重启应用就能看到效果,大大提升开发效率;二是生产上运行的程序,可以在不停止运行的情况下进行升级,不影响用户使用。
全栈程序员站长
2022/08/31
6.1K0
Idea配置热部署「建议收藏」
IDEA 插件最佳组合:JRebel+XRebel 完成项目热部署和接口分析优化,太爽了!
IDEA上原生是不支持热部署的,当我们修改代码和配置文件等大部分操作时,都需要重启服务器。
一行Java
2023/02/23
3.6K0
IDEA 插件最佳组合:JRebel+XRebel 完成项目热部署和接口分析优化,太爽了!
IDEA 插件最佳组合:JRebel+XRebel 热部署和接口分析优化,太爽了!
IDEA上原生是不支持热部署的,当我们修改代码和配置文件等大部分操作时,都需要重启服务器。
码猿技术专栏
2023/05/01
3.9K0
IDEA 插件最佳组合:JRebel+XRebel 热部署和接口分析优化,太爽了!
IDEA 配置 JRebel 热部署
在平常的开发项目中,我们改动代码需要频繁的重启,如果机器配置不好、项目比较大的情况下,重启一次项目,多则 5 ~ 6 分钟,少则 2 ~ 3 分钟,效率低而且极其浪费时间。
kirito-moe
2021/01/26
2.9K0
热部署插件JRebel的安装和使用
JRebel是一款JVM插件,通过跳过耗时的构建和重新部署步骤,简化了Java应用程序开发。使用JRebel,开发人员可以实时查看代码更改,保持应用程序状态,并提高编码效率。
布禾
2021/06/24
3.4K0
在 IDEA 中用了热部署神器 JRebel 之后,开发效率大大提升!
来源:github.com/judasn/IntelliJ-IDEA-Tutorial
猿天地
2021/03/12
2K0
在 IDEA 中用了热部署神器 JRebel 之后,开发效率大大提升!
JRebel热部署插件
1、打开File -> setting,选择Plugins->Browse Repositories
java后端指南
2021/05/13
1.1K0
JRebel热部署插件
IDEA 中的热部署神器!
在 Java Web 开发中, 一般更新了 Java 文件后要手动重启 Tomcat 服务器, 才能生效, 浪费不少生命啊, 自从有了 JRebel 这神器的出现, 不论是更新 class 类还是更新 Spring 配置文件都能做到立马生效,大大提高开发效率。
逆锋起笔
2021/07/19
9220
IDEA使用JRebel热部署项目
作为后端开发人员,和前端联调是一个困难的活。由于家中电脑的开发环境没有公司的办公环境配置全面,项目启动后,改了代码只能重启项目。于是我想到了JRebel,由于其中遇到了一些问题,所以这里做一个记录。
飞翔的竹蜻蜓
2020/07/08
2.2K0
IDEA使用JRebel热部署项目
IDEA如何使用热部署方式启动项目?
操作步骤:打开顶部工具栏 File -> Settings -> Default Settings -> Build -> Compiler 然后勾选 Build project automatically 。
全栈程序员站长
2022/08/31
2.1K0
IDEA如何使用热部署方式启动项目?
Spring Boot热部署-JRebel
JRebel就比较牛逼了,JRebel是一款JAVA虚拟机插件,它使得JAVA程序员能在不进行重部署的情况下,即时看到代码的改变对一个应用程序带来的影响。
全栈程序员站长
2021/05/19
7880
idea热部署且开启自动编译「建议收藏」
最近调试代码需要起服务并修改代码这就导致重复工作,目前是修改服务器配置,即当idea失去焦点时更新类和资源,但是这种只支持在debug模式且是在idea失去焦点才会触发热部署,这就相对加载的慢了。此法的配置方法:
全栈程序员站长
2022/07/01
4.2K0
idea热部署且开启自动编译「建议收藏」
万字长文!超详细的IntelliJ IDEA 教程!
工欲善其事,必先利其器。在Java开发中挑选一款好的Ide环境能大大提升我们的开发效率,IntelliJ IDEA正是一个不二选择。本教程会介绍怎么对idea进行配置、使用idea进行debug和经常使用的快捷键,最后会推荐几个牛逼的idea插件,大大提升开发体验和效率。
dizhiguo
2022/09/30
5.1K0
万字长文!超详细的IntelliJ IDEA 教程!
推荐阅读
相关推荐
JRebel插件使用详解
更多 >
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
本文部分代码块支持一键运行,欢迎体验
本文部分代码块支持一键运行,欢迎体验