这是一款子比主题的卡片三点和时间显示功能,这款样式轩玮博客一直在用,而且很多人想要轩玮博客的一模一样的样式,今天教程来了,本篇教程是卡片列表的三点和时间的教程,别看错图片了,代码很好部署,话不多说直接开始!

教程开始:

[hidecontent type=”payshow” desc=”隐藏内容:付费阅读”]

第一步:添加css代码

后台子比主题设置 ––>>自定义CSS样式 位置放置下方CSS代码

.posts-item {
    position: relative;
}

.post-time-absolute {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 8px 14px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    z-index: 2;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.white-theme .post-time-absolute {
    background: rgba(255, 255, 255, 0.25);
    color: #2d3748;
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.dark-theme .post-time-absolute {
    background: rgba(15, 15, 15, 0.3);
    color: #e2e8f0;
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

@media (max-width: 768px) {
    .post-time-absolute {
        top: 10px;
        right: 10px;
        padding: 6px 12px;
        font-size: 11px;
        backdrop-filter: blur(15px) saturate(160%);
        -webkit-backdrop-filter: blur(15px) saturate(160%);
        border-radius: 10px;
    }
}

@media (max-width: 480px) {
    .post-time-absolute {
        top: 8px;
        right: 8px;
        padding: 5px 10px;
        font-size: 10px;
        border-radius: 8px;
    }
}

.post-time-absolute:hover {
    transform: translateY(-2px) scale(1.02);
    backdrop-filter: blur(25px) saturate(200%);
    -webkit-backdrop-filter: blur(25px) saturate(200%);
}

.white-theme .post-time-absolute:hover {
    background: rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.dark-theme .post-time-absolute:hover {
    background: rgba(20, 20, 20, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

@supports not (backdrop-filter: blur(10px)) {
    .post-time-absolute {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    
    .white-theme .post-time-absolute {
        background: rgba(255, 255, 255, 0.85);
    }
    
    .dark-theme .post-time-absolute {
        background: rgba(0, 0, 0, 0.75);
    }
}

.post-time-absolute:active {
    transform: translateY(0) scale(0.98);
    transition-duration: 0.1s;
}

第二步:修改zib-posts-list.php文件

找到 /wp-content/themes/zibll/inc/functions/zib-posts-list.php文件,我们在这个文件里面搜

function zib_posts_mian_list_card($args = array())

然后将此段代码删除 或者 注释掉,然后再将下面的代码 粘贴在此位置即可

//获取卡片模式的文章列表
function zib_posts_mian_list_card($args = array())
{
    //准备必要参数
    $graphic = zib_get_posts_thumb_graphic();
    $title   = zib_get_posts_list_title();
    $badge   = zib_get_posts_list_badge($args);
    $meta    = zib_get_posts_list_meta(empty($args['no_author']), true);
    $time_html = '';
    if (get_the_date()) {
        $time_html = '<div class="post-time-absolute">' . get_the_date() . '</div>';
    }

    $class = 'posts-item card ajax-item';
    $style = _pz('list_card_option', '', 'style');
    $class .= $style && $style != 'null' ? ' ' . $style : '';

    $html = '';
    $html .= '<posts class="' . $class . '">';
    $html .= $graphic;
    $html .= $time_html; 
    $html .= '<div class="item-body">';
    $html .= $title;
    $html .= $badge;
    $html .= $meta;
    $html .= '</div>';
    $html .= '</posts>';
    return $html;
}

 

[/hidecontent]

 

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。