美化笔记·LOGO扫描·在线人数·卡片工具· 右键菜单·资源下载按钮

1、子比主题功能 – 卡片小工具展示

功能截图

前端

图片[1]-子比主题功能 - 卡片小工具展示

后端

图片[2]-子比主题功能 - 卡片小工具展示

部署教程

打开/wp-content/themes/zibll/functions.php文件,把下面粘贴下去

/*星空知 www.xkzhi.com*/
class Anime_Social_Responsibility_Widget extends WP_Widget {

    function __construct() {
        parent::__construct(
            'anime_social_widget',
            __('星空卡片小工具', 'text_domain'),
            array('description' => __('显示自定义的卡片', 'text_domain'))
        );
    }

    // 创建小工具后台表单
    public function form($instance) {
        $defaults = array(
            'main_title' => '二次元公益',
            'subtitle' => 'Anime Social Responsibility',
            'card1_title' => '动漫创作扶持计划',
            'card1_desc' => '支持新生代动漫创作者,提供创作基金与专业指导,助力国漫崛起。',
            'card1_image' => 'https://images.unsplash.com/photo-1638803040283-7a5ffd48dad5?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80',
            'card1_link' => 'https://www.xkzhi.com/',
            
            'card2_title' => '二次元文化传承',
            'card2_desc' => '举办全国动漫文化节,保护传统二次元文化,推广健康动漫价值观。',
            'card2_image' => 'https://images.unsplash.com/photo-1579546929662-711aa81148cf?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80',
            'card2_link' => 'https://www.xkzhi.com/',
            
            'card3_title' => '动漫公益慈善',
            'card3_desc' => '联合知名动漫IP开展慈善活动,为贫困地区儿童送去动漫温暖。',
            'card3_image' => 'https://images.unsplash.com/photo-1545569341-9eb8b30979d9?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80',
            'card3_link' => 'https://www.xkzhi.com/',
            
            'card4_title' => '动漫教育普及',
            'card4_desc' => '建立动漫教育基金,让更多青少年接触和学习动漫创作技能。',
            'card4_image' => 'https://images.unsplash.com/photo-1542831371-29b0f74f9713?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80',
            'card4_link' => 'https://www.xkzhi.com/'
        );
        
        $instance = wp_parse_args((array) $instance, $defaults);
        ?>
        

        <!-- 副标题 -->
        <p>
            <label for="<?php echo $this->get_field_id('subtitle'); ?>">标题:</label>
            <input class="widefat" id="<?php echo $this->get_field_id('subtitle'); ?>" 
                   name="<?php echo $this->get_field_name('subtitle'); ?>" 
                   type="text" value="<?php echo esc_attr($instance['subtitle']); ?>" />
        </p>

        <hr style="margin: 20px 0; border: 1px solid #ddd;">

        <!-- 卡片1设置 -->
        <h3>卡片1设置</h3>
        <p>
            <label for="<?php echo $this->get_field_id('card1_title'); ?>">标题:</label>
            <input class="widefat" id="<?php echo $this->get_field_id('card1_title'); ?>" 
                   name="<?php echo $this->get_field_name('card1_title'); ?>" 
                   type="text" value="<?php echo esc_attr($instance['card1_title']); ?>" />
        </p>
        <p>
            <label for="<?php echo $this->get_field_id('card1_desc'); ?>">描述:</label>
            <textarea class="widefat" id="<?php echo $this->get_field_id('card1_desc'); ?>" 
                      name="<?php echo $this->get_field_name('card1_desc'); ?>"><?php echo esc_textarea($instance['card1_desc']); ?></textarea>
        </p>
        <p>
            <label for="<?php echo $this->get_field_id('card1_image'); ?>">图片URL:</label>
            <input class="widefat" id="<?php echo $this->get_field_id('card1_image'); ?>" 
                   name="<?php echo $this->get_field_name('card1_image'); ?>" 
                   type="text" value="<?php echo esc_url($instance['card1_image']); ?>" />
        </p>
        <p>
            <label for="<?php echo $this->get_field_id('card1_link'); ?>">链接:</label>
            <input class="widefat" id="<?php echo $this->get_field_id('card1_link'); ?>" 
                   name="<?php echo $this->get_field_name('card1_link'); ?>" 
                   type="text" value="<?php echo esc_url($instance['card1_link']); ?>" />
        </p>

        <hr style="margin: 20px 0; border: 1px solid #ddd;">

        <!-- 卡片2设置 -->
        <h3>卡片2设置</h3>
        <p>
            <label for="<?php echo $this->get_field_id('card2_title'); ?>">标题:</label>
            <input class="widefat" id="<?php echo $this->get_field_id('card2_title'); ?>" 
                   name="<?php echo $this->get_field_name('card2_title'); ?>" 
                   type="text" value="<?php echo esc_attr($instance['card2_title']); ?>" />
        </p>
        <p>
            <label for="<?php echo $this->get_field_id('card2_desc'); ?>">描述:</label>
            <textarea class="widefat" id="<?php echo $this->get_field_id('card2_desc'); ?>" 
                      name="<?php echo $this->get_field_name('card2_desc'); ?>"><?php echo esc_textarea($instance['card2_desc']); ?></textarea>
        </p>
        <p>
            <label for="<?php echo $this->get_field_id('card2_image'); ?>">图片URL:</label>
            <input class="widefat" id="<?php echo $this->get_field_id('card2_image'); ?>" 
                   name="<?php echo $this->get_field_name('card2_image'); ?>" 
                   type="text" value="<?php echo esc_url($instance['card2_image']); ?>" />
        </p>
        <p>
            <label for="<?php echo $this->get_field_id('card2_link'); ?>">链接:</label>
            <input class="widefat" id="<?php echo $this->get_field_id('card2_link'); ?>" 
                   name="<?php echo $this->get_field_name('card2_link'); ?>" 
                   type="text" value="<?php echo esc_url($instance['card2_link']); ?>" />
        </p>

        <hr style="margin: 20px 0; border: 1px solid #ddd;">

        <!-- 卡片3设置 -->
        <h3>卡片3设置</h3>
        <p>
            <label for="<?php echo $this->get_field_id('card3_title'); ?>">标题:</label>
            <input class="widefat" id="<?php echo $this->get_field_id('card3_title'); ?>" 
                   name="<?php echo $this->get_field_name('card3_title'); ?>" 
                   type="text" value="<?php echo esc_attr($instance['card3_title']); ?>" />
        </p>
        <p>
            <label for="<?php echo $this->get_field_id('card3_desc'); ?>">描述:</label>
            <textarea class="widefat" id="<?php echo $this->get_field_id('card3_desc'); ?>" 
                      name="<?php echo $this->get_field_name('card3_desc'); ?>"><?php echo esc_textarea($instance['card3_desc']); ?></textarea>
        </p>
        <p>
            <label for="<?php echo $this->get_field_id('card3_image'); ?>">图片URL:</label>
            <input class="widefat" id="<?php echo $this->get_field_id('card3_image'); ?>" 
                   name="<?php echo $this->get_field_name('card3_image'); ?>" 
                   type="text" value="<?php echo esc_url($instance['card3_image']); ?>" />
        </p>
        <p>
            <label for="<?php echo $this->get_field_id('card3_link'); ?>">链接:</label>
            <input class="widefat" id="<?php echo $this->get_field_id('card3_link'); ?>" 
                   name="<?php echo $this->get_field_name('card3_link'); ?>" 
                   type="text" value="<?php echo esc_url($instance['card3_link']); ?>" />
        </p>

        <hr style="margin: 20px 0; border: 1px solid #ddd;">

        <!-- 卡片4设置 -->
        <h3>卡片4设置</h3>
        <p>
            <label for="<?php echo $this->get_field_id('card4_title'); ?>">标题:</label>
            <input class="widefat" id="<?php echo $this->get_field_id('card4_title'); ?>" 
                   name="<?php echo $this->get_field_name('card4_title'); ?>" 
                   type="text" value="<?php echo esc_attr($instance['card4_title']); ?>" />
        </p>
        <p>
            <label for="<?php echo $this->get_field_id('card4_desc'); ?>">描述:</label>
            <textarea class="widefat" id="<?php echo $this->get_field_id('card4_desc'); ?>" 
                      name="<?php echo $this->get_field_name('card4_desc'); ?>"><?php echo esc_textarea($instance['card4_desc']); ?></textarea>
        </p>
        <p>
            <label for="<?php echo $this->get_field_id('card4_image'); ?>">图片URL:</label>
            <input class="widefat" id="<?php echo $this->get_field_id('card4_image'); ?>" 
                   name="<?php echo $this->get_field_name('card4_image'); ?>" 
                   type="text" value="<?php echo esc_url($instance['card4_image']); ?>" />
        </p>
        <p>
            <label for="<?php echo $this->get_field_id('card4_link'); ?>">链接:</label>
            <input class="widefat" id="<?php echo $this->get_field_id('card4_link'); ?>" 
                   name="<?php echo $this->get_field_name('card4_link'); ?>" 
                   type="text" value="<?php echo esc_url($instance['card4_link']); ?>" />
        </p>

        <?php
    }

    // 更新小工具设置
    public function update($new_instance, $old_instance) {
        $instance = $old_instance;
        
        $instance['subtitle'] = sanitize_text_field($new_instance['subtitle']);
        
        // 卡片1
        $instance['card1_title'] = sanitize_text_field($new_instance['card1_title']);
        $instance['card1_desc'] = sanitize_textarea_field($new_instance['card1_desc']);
        $instance['card1_image'] = esc_url_raw($new_instance['card1_image']);
        $instance['card1_link'] = esc_url_raw($new_instance['card1_link']);
        
        // 卡片2
        $instance['card2_title'] = sanitize_text_field($new_instance['card2_title']);
        $instance['card2_desc'] = sanitize_textarea_field($new_instance['card2_desc']);
        $instance['card2_image'] = esc_url_raw($new_instance['card2_image']);
        $instance['card2_link'] = esc_url_raw($new_instance['card2_link']);
        
        // 卡片3
        $instance['card3_title'] = sanitize_text_field($new_instance['card3_title']);
        $instance['card3_desc'] = sanitize_textarea_field($new_instance['card3_desc']);
        $instance['card3_image'] = esc_url_raw($new_instance['card3_image']);
        $instance['card3_link'] = esc_url_raw($new_instance['card3_link']);
        
        // 卡片4
        $instance['card4_title'] = sanitize_text_field($new_instance['card4_title']);
        $instance['card4_desc'] = sanitize_textarea_field($new_instance['card4_desc']);
        $instance['card4_image'] = esc_url_raw($new_instance['card4_image']);
        $instance['card4_link'] = esc_url_raw($new_instance['card4_link']);
        
        return $instance;
    }

    // 前台显示小工具
    public function widget($args, $instance) {
        // 输出小工具容器,但不输出WordPress默认的标题
        echo $args['before_widget'];
        
        // 检查是否设置了WordPress小工具标题,如果有就清空它
        $widget_title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
        
        // 如果WordPress小工具标题不为空,我们手动处理它
        if (!empty($widget_title)) {
            // 但我们不输出它,因为我们有自己的标题系统
            // 或者你可以选择输出它,但通常我们不需要
        }
        
        // 输出小工具内容
        ?>
        <div class="anime-social-responsibility-container">
            <!-- 标题区域 - 在卡片上方 -->
            <div class="anime-header">
                <p class="anime-subtitle"><?php echo esc_html($instance['subtitle']); ?></p>
                <div class="anime-title-divider"></div>
            </div>
            
            <!-- 卡片区域 -->
            <div class="anime-box-content">
                <!-- 卡片1 -->
                <a href="<?php echo esc_url($instance['card1_link']); ?>" rel="external nofollow"  target="_blank" class="anime-card anime-card-1" style="background-image: url('<?php echo esc_url($instance['card1_image']); ?>')">
                    <div class="anime-card-content">
                        <p><?php echo esc_html($instance['card1_title']); ?></p>
                        <span><?php echo esc_html($instance['card1_desc']); ?></span>
                    </div>
                </a>
                
                <!-- 卡片2 -->
                <a href="<?php echo esc_url($instance['card2_link']); ?>" rel="external nofollow"  target="_blank" class="anime-card anime-card-2" style="background-image: url('<?php echo esc_url($instance['card2_image']); ?>')">
                    <div class="anime-card-content">
                        <p><?php echo esc_html($instance['card2_title']); ?></p>
                        <span><?php echo esc_html($instance['card2_desc']); ?></span>
                    </div>
                </a>
                
                <!-- 卡片3 -->
                <a href="<?php echo esc_url($instance['card3_link']); ?>" rel="external nofollow"  target="_blank" class="anime-card anime-card-3" style="background-image: url('<?php echo esc_url($instance['card3_image']); ?>')">
                    <div class="anime-card-content">
                        <p><?php echo esc_html($instance['card3_title']); ?></p>
                        <span><?php echo esc_html($instance['card3_desc']); ?></span>
                    </div>
                </a>
                
                <!-- 卡片4 -->
                <a href="<?php echo esc_url($instance['card4_link']); ?>" rel="external nofollow"  target="_blank" class="anime-card anime-card-4" style="background-image: url('<?php echo esc_url($instance['card4_image']); ?>')">
                    <div class="anime-card-content">
                        <p><?php echo esc_html($instance['card4_title']); ?></p>
                        <span><?php echo esc_html($instance['card4_desc']); ?></span>
                    </div>
                </a>
            </div>
        </div>
        
        <style>
        .anime-social-responsibility-container {
            width: 100%;
            position: relative;
            z-index: 10;
            padding: 20px 0;
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Microsoft YaHei", sans-serif;
        }
        
        .anime-social-responsibility-container .anime-header {
            text-align: center;
            margin-bottom: 50px;
            width: 100%;
        }
        
        .anime-social-responsibility-container .anime-main-title {
            font-size: 48px;
            font-weight: 900;
            color: #ff4081;
            margin-bottom: 12px;
            letter-spacing: 2px;
            text-shadow: 3px 3px 0px #ff9ec0, 6px 6px 0px rgba(0,0,0,0.1);
            position: relative;
            display: inline-block;
        }
        
        .anime-social-responsibility-container .anime-main-title::after {
            content: "";
            position: absolute;
            bottom: -10px;
            left: 10%;
            width: 80%;
            height: 8px;
            background: linear-gradient(to right, #ff4081, #7b68ee);
            border-radius: 4px;
            transform: skewX(-15deg);
        }
        
        .anime-social-responsibility-container .anime-subtitle {
            font-size: 22px;
            color: #7b68ee;
            margin-bottom: 25px;
            font-weight: 700;
            letter-spacing: 3px;
            text-shadow: 1px 1px 0px white;
            background: rgba(255,255,255,0.7);
            display: inline-block;
            padding: 8px 20px;
            border-radius: 30px;
            border: 2px dashed #7b68ee;
        }
        
        .anime-social-responsibility-container .anime-title-divider {
            width: 100px;
            height: 6px;
            background: linear-gradient(to right, #ff4081, #7b68ee);
            margin: 0 auto;
            border-radius: 3px;
            box-shadow: 0 2px 8px rgba(123, 104, 238, 0.5);
            position: relative;
        }
        
        .anime-social-responsibility-container .anime-title-divider::before, 
        .anime-social-responsibility-container .anime-title-divider::after {
            content: "✦";
            position: absolute;
            top: -8px;
            color: #7b68ee;
            font-size: 18px;
        }
        
        .anime-social-responsibility-container .anime-title-divider::before {
            left: -15px;
        }
        
        .anime-social-responsibility-container .anime-title-divider::after {
            right: -15px;
        }
        
        .anime-social-responsibility-container .anime-box-content {
            display: flex;
            justify-content: center;
            gap: 20px;
            flex-wrap: nowrap;
            width: 100%;
        }
        
        .anime-social-responsibility-container .anime-card {
            display: flex;
            flex-direction: column;
            flex: 1;
            min-width: 0;
            height: 350px;
            background-size: cover;
            background-position: center;
            border-radius: 20px;
            overflow: hidden;
            text-decoration: none;
            color: inherit;
            box-shadow: 0 10px 25px rgba(123, 104, 238, 0.2);
            transition: all 0.4s ease;
            position: relative;
            border: 3px solid white;
        }
        
        .anime-social-responsibility-container .anime-card::before {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.7) 100%);
            z-index: 1;
            border-radius: 18px;
            transition: all 0.4s ease;
        }
        
        .anime-social-responsibility-container .anime-card:hover::before {
            background: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0.8) 100%);
        }
        
        .anime-social-responsibility-container .anime-card:hover {
            transform: translateY(-12px) scale(1.03);
            box-shadow: 0 20px 35px rgba(123, 104, 238, 0.4);
        }
        
        .anime-social-responsibility-container .anime-card-content {
            padding: 25px 20px;
            flex-grow: 1;
            display: flex;
            flex-direction: column;
            justify-content: flex-end;
            position: relative;
            z-index: 2;
            color: white;
        }
        
        .anime-social-responsibility-container .anime-card p {
            font-size: 22px;
            font-weight: 900;
            margin-bottom: 15px;
            color: white;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
            position: relative;
            padding-left: 15px;
        }
        
        .anime-social-responsibility-container .anime-card p::before {
            content: "";
            position: absolute;
            left: 0;
            top: 0;
            height: 100%;
            width: 5px;
            background: linear-gradient(to bottom, #ff4081, #7b68ee);
            border-radius: 3px;
        }
        
        .anime-social-responsibility-container .anime-card span {
            font-size: 15px;
            color: rgba(255,255,255,0.9);
            line-height: 1.6;
            background: rgba(0,0,0,0.3);
            padding: 10px;
            border-radius: 10px;
            border: 1px solid rgba(255,255,255,0.3);
        }
        
        /* 响应式设计 */
        @media (max-width: 1024px) {
            .anime-social-responsibility-container .anime-box-content {
                flex-wrap: wrap;
            }
            
            .anime-social-responsibility-container .anime-card {
                flex: 0 0 calc(50% - 20px);
                height: 300px;
            }
        }
        
        @media (max-width: 768px) {
            .anime-social-responsibility-container .anime-box-content {
                flex-direction: column;
                align-items: center;
            }
            
            .anime-social-responsibility-container .anime-card {
                flex: 1;
                width: 100%;
                max-width: 400px;
                height: 250px;
            }
            
            .anime-social-responsibility-container .anime-main-title {
                font-size: 36px;
            }
            
            .anime-social-responsibility-container .anime-subtitle {
                font-size: 18px;
            }
        }
        </style>
        <?php
        
        echo $args['after_widget'];
    }
}

// 注册小工具
function register_anime_social_widget() {
    register_widget('Anime_Social_Responsibility_Widget');
}
add_action('widgets_init', 'register_anime_social_widget');

2、子比主题美化 – 背景穿梭文字样式代码

代码教程:

复制下方代码,以html代码格式放在需要展示的位置即可

子比主题:后台 外观—》小工具—》自定义html—>添加到需要的位置—》粘贴代码,修改文字

<div class="tfbk_gdz"><p><span>春眠不觉晓 WWW.CMBJX.COM</span></p></div>
<style>
.tfbk_gdz p span {
font-size: 26px;
letter-spacing: 0;
display: block;
margin: 0 auto;
text-shadow: 0 0 80px rgb(255 255 255 / 50%);
background: url(https://img.alicdn.com/imgextra/i2/2210123621994/O1CN012KU4kP1QbIqA8O4NT_!!2210123621994.png) repeat-y;
-webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent;
-webkit-animation: aitf 80s linear infinite;
-webkit-transform: translate3d(0, 0, 0);
-webkit-backface-visibility: hidden;
}
@-webkit-keyframes aitf {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 100% 50%;
  }
}
@keyframes aitf {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 100% 50%;
  }
}
</style>

3、子比主题 – 在线用户小工具

1.前端

图片[1]-子比主题 - 在线用户小工具
有用户
图片[2]-子比主题 - 在线用户小工具
无用户

2.后端

图片[3]-子比主题 - 在线用户小工具

在这里我解释下:

这个在线时间就是用户活动的时间检测,60s一次,用户不活动时视为离线,放心这个不会占用多少服务器资源的

美化教程

.

首先进入文件管理网站文件/******/wp-content/themes/zibll/functions.php

把下面代码复制进去就行了然后进入小工具启用

/**
Plugin Name: 春晓-在线用户-开始
Plugin URI: https://www.qlwq.cc/
Author: 空白(留点尊严)
**/

/*星空知-在线用户-开始-cmbjx.com(留下我)*/
// 登录时设置活动状态
function track_user_login($user_login, $user) {
    update_user_meta($user->ID, 'last_activity', time());
    update_user_meta($user->ID, 'is_logged_in', '1');
}
add_action('wp_login', 'track_user_login', 10, 2);

// 每次页面加载时更新活动时间
function update_user_activity() {
    if (is_user_logged_in()) {
        $user_id = get_current_user_id();
        update_user_meta($user_id, 'last_activity', time());
        update_user_meta($user_id, 'is_logged_in', '1');
    }
}
add_action('init', 'update_user_activity');

// 登出时更新状态
function track_user_logout() {
    $user_id = get_current_user_id();
    update_user_meta($user_id, 'is_logged_in', '0');
}
add_action('wp_logout', 'track_user_logout');


class Online_Users_Widget extends WP_Widget {

    // 构造函数
    function __construct() {
        parent::__construct(
            'online_users_widget',
            __('星空知-在线用户', 'text_domain'),
            array(
                'description' => __('显示在线用户列表', 'text_domain'),
                'classname' => 'widget_online_users'
            )
        );
    }

    // 前端显示(带悬浮效果)
    public function widget($args, $instance) {
        // 获取设置
        $title = apply_filters('widget_title', empty($instance['title']) ? __('在线用户', 'text_domain') : $instance['title']);
        $inactive_time = empty($instance['inactive_time']) ? 60 : absint($instance['inactive_time']);
        $show_count = !empty($instance['show_count']);
        
        // 开始输出
        echo $args['before_widget'];
        if (!empty($title)) {
            echo $args['before_title'] . '<span class="online-title-icon">👥</span>' . esc_html($title) . $args['after_title'];
        }
        
        // 获取在线用户
        $online_users = $this->get_online_users($inactive_time);
        
        // 显示用户列表
        if (!empty($online_users)) {
            if ($show_count) {
                echo '<div class="online-users-count">';
                echo '<span class="count-bubble">' . count($online_users) . '</span>';
                printf(
                    _n('当前有 %d 位用户在线', '当前有 %d 位用户在线', count($online_users), 'text_domain'), 
                    count($online_users)
                );
                echo '</div>'; 
            }
            
            echo '<ul class="online-users-list">';
            foreach ($online_users as $user) {
                $display_name = !empty($user->display_name) ? $user->display_name : $user->user_login;
                $avatar = get_avatar($user->ID, 96);
                $user_link = get_author_posts_url($user->ID);
                $last_active = $this->relative_time((int)get_user_meta($user->ID, 'last_activity', true));
                
                echo '<li class="online-user">';
                echo '<a href="' . esc_url($user_link) . '" rel="external nofollow"  class="user-card" title="' . esc_attr($display_name) . '">';
                echo '<div class="avatar-container">';
                echo $avatar;
                echo '<span class="online-status" title="在线"></span>';
                echo '</div>';
                echo '<span class="online-user-name">' . esc_html($display_name) . '</span>';
                
                // 悬浮卡片
                echo '<div class="user-hover-card">';
                echo '<div class="hover-avatar">' . get_avatar($user->ID, 120) . '</div>';
                echo '<h4>' . esc_html($display_name) . '</h4>';
                echo '<p><i class="activity-icon"></i> ' . esc_html($last_active) . '</p>';
                echo '</div>';
                
                echo '</a>';
                echo '</li>';
            }
            echo '</ul>';
        } else {
            echo '<div class="no-online-users">';
            echo '<div class="empty-state">';
            echo '<span class="empty-icon">👻</span>';
            echo '<p>' . __('当前没有用户在线', 'text_domain') . '</p>';
            echo '</div>';
            echo '</div>';
        }
        
        echo $args['after_widget'];
    }

    // 相对时间显示
    private function relative_time($timestamp) {
        $current_time = time();
        $diff = $current_time - $timestamp;
        
        if ($diff < 60) {
            return __('刚刚在线', 'text_domain');
        } elseif ($diff < 3600) {
            return sprintf(__('%d分钟前', 'text_domain'), floor($diff/60));
        } elseif ($diff < 86400) {
            return sprintf(__('%d小时前', 'text_domain'), floor($diff/3600));
        } else {
            return date(__('Y年m月d日', 'text_domain'), $timestamp);
        }
    }

    // 后台表单
    public function form($instance) {
        $defaults = array(
            'title' => __('在线用户', 'text_domain'),
            'inactive_time' => 60,
            'show_count' => true
        );
        $instance = wp_parse_args((array) $instance, $defaults);
        ?>
        <p>
            <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('标题:'); ?></label>
            <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" 
                   name="<?php echo $this->get_field_name('title'); ?>" 
                   type="text" value="<?php echo esc_attr($instance['title']); ?>" />
        </p>
        <p>
            <label for="<?php echo $this->get_field_id('inactive_time'); ?>"><?php _e('视为在线的时间(秒):'); ?></label>
            <input class="widefat" id="<?php echo $this->get_field_id('inactive_time'); ?>" 
                   name="<?php echo $this->get_field_name('inactive_time'); ?>" 
                   type="number" min="60" value="<?php echo esc_attr($instance['inactive_time']); ?>" />
            <small><?php _e('默认60秒'); ?></small>
        </p>
        <p>
            <input class="checkbox" type="checkbox" id="<?php echo $this->get_field_id('show_count'); ?>" 
                   name="<?php echo $this->get_field_name('show_count'); ?>" 
                   <?php checked($instance['show_count'], true); ?> />
            <label for="<?php echo $this->get_field_id('show_count'); ?>"><?php _e('显示在线人数'); ?></label>
        </p>
        <?php
    }

    // 更新设置
    public function update($new_instance, $old_instance) {
        $instance = $old_instance;
        $instance['title'] = sanitize_text_field($new_instance['title']);
        $instance['inactive_time'] = absint($new_instance['inactive_time']);
        $instance['show_count'] = !empty($new_instance['show_count']);
        return $instance;
    }

    // 获取在线用户列表
    private function get_online_users($inactive_time = 60) {
        $current_time = time();
        $online_users = array();
        
        $users = get_users(array(
            'meta_query' => array(
                array(
                    'key' => 'last_activity',
                    'compare' => 'EXISTS'
                )
            )
        ));
        
        foreach ($users as $user) {
            $last_activity = (int)get_user_meta($user->ID, 'last_activity', true);
            $is_logged_in = get_user_meta($user->ID, 'is_logged_in', true);
            
            if (($current_time - $last_activity <= $inactive_time) && $is_logged_in === '1') {
                $online_users[$user->ID] = $user;
            }
        }
        
        return $online_users;
    }
}

// 注册小工具
function register_online_users_widget() {
    register_widget('Online_Users_Widget');
}
add_action('widgets_init', 'register_online_users_widget');

//初始化用户状态

function initialize_user_status() {
    if (!get_option('online_users_status_initialized')) {
        $users = get_users();
        foreach ($users as $user) {
            if (!metadata_exists('user', $user->ID, 'is_logged_in')) {
                update_user_meta($user->ID, 'is_logged_in', '0');
            }
            if (!metadata_exists('user', $user->ID, 'last_activity')) {
                update_user_meta($user->ID, 'last_activity', time());
            }
        }
        update_option('online_users_status_initialized', true);
    }
}
add_action('admin_init', 'initialize_user_status');

// CSS

function online_users_widget_styles() {
    ?>
    <style>
    /* 基础样式 - 优化阴影 */
    .widget_online_users {
        background: linear-gradient(135deg, #f5f7fa 0%, #f8fafc 100%);
        border-radius: 16px;
        box-shadow: 
            0 1px 1px rgba(0,0,0,0.02),
            0 2px 2px rgba(0,0,0,0.02),
            0 4px 4px rgba(0,0,0,0.02),
            0 8px 8px rgba(0,0,0,0.03),
            0 16px 16px rgba(0,0,0,0.03);
        padding: 25px;
        margin-bottom: 30px;
        border: 1px solid rgba(255,255,255,0.5);
        backdrop-filter: blur(8px);
        transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    }
    
    .widget_online_users:hover {
        box-shadow: 
            0 1px 1px rgba(0,0,0,0.03),
            0 2px 2px rgba(0,0,0,0.03),
            0 4px 4px rgba(0,0,0,0.03),
            0 8px 8px rgba(0,0,0,0.04),
            0 16px 16px rgba(0,0,0,0.04),
            0 24px 24px rgba(0,0,0,0.05);
        transform: translateY(-3px) scale(1.005);
    }
    
    /* 标题样式 */
    .widget_online_users .widget-title {
        font-size: 1.3em;
        color: #2d3748;
        margin-bottom: 20px;
        padding-bottom: 12px;
        border-bottom: 1px solid rgba(0,0,0,0.05);
        display: flex;
        align-items: center;
        font-weight: 600;
    }
    
    .online-title-icon {
        margin-right: 10px;
        font-size: 1.2em;
        filter: drop-shadow(0 1px 1px rgba(0,0,0,0.1));
    }
    
    /* 在线人数统计 */
    .widget_online_users .online-users-count {
        background: rgba(74, 85, 104, 0.1);
        padding: 8px 15px;
        border-radius: 50px;
        font-size: 0.9em;
        color: #4a5568;
        margin-bottom: 20px;
        display: inline-flex;
        align-items: center;
        transition: all 0.3s ease;
    }
    
    .widget_online_users .online-users-count:hover {
        background: rgba(74, 85, 104, 0.2);
    }
    
    .count-bubble {
        background: linear-gradient(135deg, #4CAF50 0%, #81C784 100%);
        color: white;
        width: 24px;
        height: 24px;
        border-radius: 50%;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-right: 8px;
        font-size: 0.8em;
        font-weight: bold;
        box-shadow: 
            0 1px 1px rgba(76, 175, 80, 0.2),
            0 2px 2px rgba(76, 175, 80, 0.15),
            0 4px 4px rgba(76, 175, 80, 0.1);
    }
    
    /* 用户列表 */
    .widget_online_users .online-users-list {
        list-style: none;
        padding: 0;
        margin: 0 -5px;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    /* 单个用户项 */
    .widget_online_users .online-user {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 80px;
        margin: 0 5px 15px;
        position: relative;
    }
    
    .widget_online_users .user-card {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-decoration: none;
        transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        position: relative;
        will-change: transform;
    }
    
    .widget_online_users .user-card:hover {
        transform: translateY(-5px);
    }
    
    /* 头像容器 */
    .widget_online_users .avatar-container {
        position: relative;
        margin-bottom: 8px;
        transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        will-change: transform;
    }
    
    .widget_online_users .user-card:hover .avatar-container {
        transform: scale(1.05);
    }
    
    /* 用户头像 */
    .widget_online_users .online-user img.avatar {
        width: 60px;
        height: 60px;
        border-radius: 50%;
        object-fit: cover;
        border: 3px solid white;
        box-shadow: 
            0 1px 1px rgba(0,0,0,0.05),
            0 2px 2px rgba(0,0,0,0.05),
            0 4px 4px rgba(0,0,0,0.05),
            0 6px 6px rgba(0,0,0,0.06);
        transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    }
    
    .widget_online_users .user-card:hover img.avatar {
        box-shadow: 
            0 2px 2px rgba(0,0,0,0.06),
            0 4px 4px rgba(0,0,0,0.06),
            0 8px 8px rgba(0,0,0,0.07),
            0 12px 12px rgba(0,0,0,0.08);
    }
    
    /* 在线状态指示器 */
    .widget_online_users .online-status {
        position: absolute;
        bottom: 5px;
        right: 5px;
        width: 14px;
        height: 14px;
        background: linear-gradient(135deg, #4CAF50 0%, #81C784 100%);
        border-radius: 50%;
        border: 2px solid white;
        box-shadow: 
            0 0 0 1px rgba(76, 175, 80, 0.2),
            0 0 0 2px rgba(76, 175, 80, 0.15);
        animation: pulse 1.5s infinite;
        z-index: 2;
    }
    
    /* 用户名 */
    .widget_online_users .online-user-name {
        font-size: 0.8em;
        color: #4a5568;
        text-align: center;
        word-break: break-word;
        line-height: 1.4;
        font-weight: 500;
        transition: all 0.3s ease;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
    
    .widget_online_users .user-card:hover .online-user-name {
        color: #2d3748;
        font-weight: 600;
    }
    
.widget_online_users .user-hover-card {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    width: 180px;
    background: white;
    border-radius: 12px;
    padding: 15px;
    opacity: 0;
    visibility: hidden;
    transition: 
        opacity 0.3s ease-out,
        transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    z-index: 10;
    pointer-events: none;
    text-align: center;
    /* 已移除所有阴影相关属性 */
    box-shadow: none;
    filter: none;
}

.widget_online_users .user-card:hover .user-hover-card {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    /* 已移除悬浮状态的阴影增强 */
    box-shadow: none;
    filter: none;
}
    
    /* 添加卡片升起时的微光效果 */
    .widget_online_users .user-hover-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 40%;
        background: linear-gradient(to bottom, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0) 100%);
        border-radius: 12px 12px 0 0;
        opacity: 0;
        transition: opacity 0.4s ease;
    }
    
    .widget_online_users .user-card:hover .user-hover-card::before {
        opacity: 0.6;
    }
    
    /* 优化卡片内容过渡 */
    .widget_online_users .user-hover-card > * {
        transform: translateY(5px);
        opacity: 0.9;
        transition: 
            transform 0.4s cubic-bezier(0.23, 1, 0.32, 1),
            opacity 0.4s ease;
    }
    
    .widget_online_users .user-card:hover .user-hover-card > * {
        transform: translateY(0);
        opacity: 1;
    }
    
    /* 延迟子元素动画 */
    .widget_online_users .user-hover-card .hover-avatar {
        transition-delay: 0.05s;
    }
    
    .widget_online_users .user-hover-card h4 {
        transition-delay: 0.1s;
    }
    
    .widget_online_users .user-hover-card p {
        transition-delay: 0.15s;
    }
    
    .activity-icon {
        display: inline-block;
        width: 12px;
        height: 12px;
        background: #4CAF50;
        border-radius: 50%;
        margin-right: 5px;
        animation: pulse 1.5s infinite;
    }
    
    /* 无用户状态 */
    .widget_online_users .no-online-users {
        padding: 20px 0;
    }
    
    .widget_online_users .empty-state {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .widget_online_users .empty-icon {
        font-size: 2em;
        opacity: 0.5;
        margin-bottom: 10px;
        filter: drop-shadow(0 1px 1px rgba(0,0,0,0.1));
    }
    
    .widget_online_users .empty-state p {
        margin: 0;
        color: #718096;
        font-size: 0.9em;
    }
    
    @keyframes pulse {
        0% { 
            transform: scale(0.95); 
            box-shadow: 
                0 0 0 0 rgba(76, 175, 80, 0.4),
                0 0 0 1px rgba(76, 175, 80, 0.3);
        }
        70% { 
            transform: scale(1.05); 
            box-shadow: 
                0 0 0 4px rgba(76, 175, 80, 0.1),
                0 0 0 6px rgba(76, 175, 80, 0);
        }
        100% { 
            transform: scale(0.95); 
            box-shadow: 
                0 0 0 0 rgba(76, 175, 80, 0),
                0 0 0 1px rgba(76, 175, 80, 0.1);
        }
    }
    
    @media (max-width: 480px) {
        .widget_online_users {
            padding: 20px 15px;
            border-radius: 12px;
        }
        
        .widget_online_users .online-user {
            width: 70px;
        }
        
        .widget_online_users .online-user img.avatar {
            width: 50px;
            height: 50px;
        }
        
        .widget_online_users .user-hover-card {
            width: 160px;
            padding: 12px;
        }
    }
    </style>
    <?php
}
add_action('wp_head', 'online_users_widget_styles');
/*春晓-在线用户-结束-cmbjx.com(留下我)*/

4、 新型右键菜单

美化截图

图片[1]-子比美化 - 新型右键菜单

美化教程

如果用的子比主题请打开子比后台设置全局功能-自定义代码-底部html 把下面代码复制下去

<style type="text/css">
    /* 基础样式重置 */
    a {
        text-decoration: none;
        color: inherit;
    }
    
    /* 菜单容器 - 修复版 */
div.usercm {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(15px) saturate(180%);
    -webkit-backdrop-filter: blur(15px) saturate(180%);
    font-size: 14px;
    width: 160px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    position: absolute;
    display: none;
    z-index: 10000;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    
    /* 新的描边方案 */
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        0 0 0 0px rgba(44, 123, 229, 0); /* 初始状态 */
}

/* 鼠标悬停时通过box-shadow添加描边 */
div.usercm:hover {
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        0 0 0 2px rgba(44, 123, 229, 0.5);
}
    
    /* 菜单列表 */
    div.usercm ul {
        list-style: none;
        margin: 0;
        padding: 5px 0;
    }
    
    /* 菜单项 */
    div.usercm ul li {
        margin: 0;
        padding: 0;
        transition: all 0.2s ease;
    }
    
    /* 菜单链接 */
    div.usercm ul li a {
        color: #555;
        padding: 10px 20px; /* 增加内边距 */
        display: flex;
        align-items: center;
        transition: all 0.2s ease;
    }
    
    /* 菜单图标 */
    div.usercm ul li a i {
        width: 20px;
        margin-right: 12px;
        text-align: center;
        color: #666;
    }
    
    /* 悬停效果 */
    div.usercm ul li:hover {
        background: rgba(100, 149, 237, 0.2); /* 更强的悬停效果 */
    }
    
    div.usercm ul li a:hover {
        color: #2c7be5;
    }
    
    div.usercm ul li a:hover i {
        color: #2c7be5;
    }
    
    /* 分隔线 */
div.usercm ul li.divider {
    height: 1px;
    background: transparent;
    border-top: 1px dashed #2c7be5;
    margin: 8px 15px;
    opacity: 0.6;
}

div.usercm ul li.divider:hover {
    opacity: 1;
}
    
    /* 禁用状态 */
    a.disabled {
        color: rgba(204, 204, 204, 0.7) !important; /* 半透明禁用状态 */
        cursor: not-allowed;
    }
    
    a.disabled:hover {
        background-color: transparent !important;
    }
    
      /* 透明风格的顶部导航容器 */
    .quick-nav {
        display: flex;
        justify-content: space-around;
        padding: 10px 10px;
        background: transparent; /* 完全透明背景 */
        border-bottom: 1px solid rgba(255, 255, 255, 0.1); /* 极细的分隔线 */
        margin-bottom: 5px;
    }
    
    /* 透明导航按钮基础样式 */
    .quick-nav a {
        padding: 8px 12px;
        border-radius: 6px;
        transition: all 0.25s ease;
        color: rgba(85, 85, 85, 0.9); /* 半透明文字 */
        font-size: 15px;
        background: transparent; /* 透明背景 */
    }
    
    /* 悬停效果 - 优雅的淡入背景 */
    .quick-nav a:hover {
        background: rgba(100, 149, 237, 0.15); /* 轻微蓝色背景 */
        color: #2c7be5; /* 悬停时文字变蓝 */
    }
    
    /* 点击效果 */
    .quick-nav a:active {
        background: rgba(100, 149, 237, 0.25); /* 点击时背景加深 */
        transform: scale(0.98); /* 轻微缩小效果 */
    }
    
    /* 图标动画 */
    .quick-nav a i {
        transition: transform 0.2s ease;
    }
    
    .quick-nav a:hover i {
        transform: scale(1.1); /* 悬停时图标轻微放大 */
    }
    
    /* 按钮边框动画 (可选) */
    .quick-nav a {
        position: relative;
    }
    
    .quick-nav a::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        border-radius: 6px;
        border: 1px solid transparent;
        transition: border-color 0.3s ease;
    }
    
    .quick-nav a:hover::after {
        border-color: rgba(100, 149, 237, 0.3); /* 悬停时显示淡淡边框 */
    }
    
    .copy-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 10001;
    white-space: nowrap;
    }
</style>


<div class="usercm" style="display: none;">
    <!-- 新增的顶部导航图标 -->
    <div class="quick-nav">
        <a href="javascript:history.go(-1);" rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  title="返回上一页"><i class="fa fa-arrow-left"></i></a>
        <a href="javascript:history.go(1);" rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  title="返回下一页"><i class="fa fa-arrow-right"></i></a>
        <a href="javascript:smoothScrollToTop();" rel="external nofollow"  rel="external nofollow"  title="返回顶部"><i class="fa fa-arrow-up"></i></a>
    </div>
    
    <ul>
        <li><a href="https://www.xkzhi.com/frieds"><i class="fa fa-meh-o fa-fw"></i><span>成为邻居</span></a></li>
        <li class="divider"></li>
        <li><a href="javascript:void(0);" rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  onclick="getSelect();"><i class="fa fa-copy"></i><span>复制内容</span></a></li>
        <li><a href="javascript:window.location.reload();" rel="external nofollow"  rel="external nofollow" ><i class="fa fa-refresh fa-fw"></i><span>刷新页面</span></a></li>
        <li class="divider"></li>
        <li><a href="https://www.xkzhi.com/"><i class="fa fa-home"></i><span>返回首页</span></a></li>
        <li><a href="javascript:history.go(1);" rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow" ><i class="fa fa-arrow-right"></i><span>前进</span></a></li>
        <li><a href="javascript:history.go(-1);" rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow" ><i class="fa fa-arrow-left"></i><span>后退</span></a></li>
        <li class="divider"></li>
        <li><a href="javascript:void(0);" rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  onclick="copyPageUrl();"><i class="fa fa-link"></i><span>复制地址</span></a></li>
        <li><a href="javascript:void(0);" rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  onclick="baiduSearch();"><i class="fa fa-search"></i><span>搜索选中内容</span></a></li>
    </ul>
</div>

<script type="text/javascript">
//顶部
let scrollAnimationId = null;

function smoothScrollToTop() {
    
    if (scrollAnimationId) {
        cancelAnimationFrame(scrollAnimationId);
    }
    
    const startPosition = window.pageYOffset;
    const startTime = performance.now();
    const duration = 800; // 动画持续时间(ms)
    
    const animateScroll = (currentTime) => {
        const elapsed = currentTime - startTime;
        const progress = Math.min(elapsed / duration, 1);
        
        // 使用缓动函数使滚动更自然
        const easeProgress = easeOutCubic(progress);
        
        window.scrollTo(0, startPosition * (1 - easeProgress));
        
        if (progress < 1) {
            scrollAnimationId = requestAnimationFrame(animateScroll);
        } else {
            scrollAnimationId = null;
        }
    };
    
    // 缓动函数 - 平滑减速
    function easeOutCubic(t) {
        return (--t) * t * t + 1;
    }
    
    // 监听用户滚动中断
    const handleUserScroll = () => {
        if (scrollAnimationId) {
            cancelAnimationFrame(scrollAnimationId);
            scrollAnimationId = null;
            window.removeEventListener('wheel', handleUserScroll);
            window.removeEventListener('touchmove', handleUserScroll);
        }
    };
    
    window.addEventListener('wheel', handleUserScroll, { passive: true });
    window.addEventListener('touchmove', handleUserScroll, { passive: true });
    
    scrollAnimationId = requestAnimationFrame(animateScroll);
}

    // 保持原有功能不变
    (function(a) {
        a.extend({
            mouseMoveShow: function(b) {
                var d = 0,
                    c = 0,
                    h = 0,
                    k = 0,
                    e = 0,
                    f = 0;
                    
                var menu = a(b);
                var isMenuShowing = false;
                var isOnImage = false;
                var imageUrl = '';
                
                // 创建提示框元素
                var tooltip = $('<div class="copy-tooltip">复制成功</div>').css({
                    'position': 'absolute',
                    'background': 'rgba(0,0,0,0.7)',
                    'color': 'white',
                    'padding': '5px 10px',
                    'border-radius': '4px',
                    'font-size': '12px',
                    'opacity': '0',
                    'transition': 'opacity 0.3s',
                    'pointer-events': 'none',
                    'z-index': '10001'
                }).appendTo('body');
                
                // 添加CSS过渡效果
                menu.css({
                    'transition': 'left 0.3s ease, top 0.3s ease'
                });
                
                // 检测是否在图片上
                function checkIfOnImage(target) {
                    var imgElement = target.closest('img');
                    if (imgElement) {
                        isOnImage = true;
                        imageUrl = imgElement.src;
                        // 修改"成为邻居"为"复制图片链接"
                        menu.find('a[href="https://www.xkzhi.com/frieds"] i')
                            .removeClass('fa-meh-o')
                            .addClass('fa-link');
                        menu.find('a[href="https://www.xkzhi.com/frieds"] span')
                            .text('复制此图片');
                    } else {
                        isOnImage = false;
                        imageUrl = '';
                        // 恢复"成为邻居"
                        menu.find('a[href="https://www.xkzhi.com/frieds"] i')
                            .removeClass('fa-link')
                            .addClass('fa-meh-o');
                        menu.find('a[href="https://www.xkzhi.com/frieds"] span')
                            .text('成为邻居');
                    }
                }
                
                // 复制图片链接函数
                function copyImageUrl() {
                    if (!isOnImage || !imageUrl) return false;
                    
                    try {
                        var tempInput = document.createElement('input');
                        tempInput.value = imageUrl;
                        document.body.appendChild(tempInput);
                        tempInput.select();
                        var success = document.execCommand('copy');
                        document.body.removeChild(tempInput);
                        
                        if (success) {
                            // 显示提示框
                            var menuPos = menu.offset();
                            tooltip.css({
                                'left': menuPos.left + menu.outerWidth() + 10,
                                'top': menuPos.top
                            }).stop().css('opacity', 1)
                              .delay(1500)
                              .animate({opacity: 0}, 500);
                            return true;
                        } else {
                            throw new Error('复制失败');
                        }
                    } catch (err) {
                        tooltip.text('复制失败').css({
                            'background': 'rgba(255,0,0,0.7)',
                            'left': menu.offset().left + menu.outerWidth() + 10,
                            'top': menu.offset().top
                        }).stop().css('opacity', 1)
                          .delay(1500)
                          .animate({opacity: 0}, 500);
                        return false;
                    }
                }
                
                a(window).mousemove(function(g) {
                    d = a(window).width();
                    c = a(window).height();
                    h = g.clientX;
                    k = g.clientY;
                    e = g.pageX;
                    f = g.pageY;
                    
                    // 调整位置防止超出窗口
                    h + menu.width() >= d && (e = e - menu.width() - 5);
                    k + menu.height() >= c && (f = f - menu.height() - 5);
                    
                    a("html").on({
                        contextmenu: function(c) {
                            if (3 == c.which) {
                                checkIfOnImage(c.target);
                                
                                if (isMenuShowing) {
                                    // 菜单已显示,平滑移动到新位置
                                    menu.css({
                                        left: e,
                                        top: f
                                    });
                                } else {
                                    // 菜单未显示,显示菜单
                                    menu.css({
                                        left: e,
                                        top: f
                                    }).show();
                                    isMenuShowing = true;
                                }
                                c.preventDefault(); // 阻止默认右键菜单
                            }
                        },
                        click: function() {
                            menu.hide();
                            isMenuShowing = false;
                        }
                    });
                });
                
                // 修改"成为邻居"的点击事件
                menu.on('click', 'a[href="https://www.xkzhi.com/frieds"]', function(e) {
                    if (isOnImage && imageUrl) {
                        e.preventDefault();
                        copyImageUrl();
                        menu.hide();
                        isMenuShowing = false;
                    }
                });
                
                // 新增:滚动时隐藏菜单
                a(window).scroll(function() {
                    menu.hide();
                    isMenuShowing = false;
                });
            },
            disabledContextMenu: function() {
                window.oncontextmenu = function() {
                    return !1
                }
            }
        })
    })(jQuery);
 
    function getSelect() {
        "" == (window.getSelection ? window.getSelection() : document.selection.createRange().text) ? layer.msg("请先选择要复制的内容!") : document.execCommand("Copy")
    }
    
    function baiduSearch() {
        var a = window.getSelection ? window.getSelection() : document.selection.createRange().text;
        "" == a ? layer.msg("请先选择要搜索的内容!") : window.open("https://www.xkzhi.com/?s=" + a)
    }
    
    $(function() {
        for (var a = navigator.userAgent, b = "Android;iPhone;SymbianOS;Windows Phone;iPad;iPod".split(";"), d = !0, c = 0; c < b.length; c++) if (0 < a.indexOf(b[c])) {
            d = !1;
            break
        }
        d && ($.mouseMoveShow(".usercm"), $.disabledContextMenu())
    });
    
    // 复制当前页面地址函数
    function copyPageUrl() {
    try {
        var tempInput = document.createElement('input');
        tempInput.value = window.location.href;
        document.body.appendChild(tempInput);
        tempInput.select();
        var success = document.execCommand('copy');
        document.body.removeChild(tempInput);
        
        if (success) {
            // 显示提示框
            var menu = $('.usercm');
            var tooltip = $('.copy-tooltip').text('已复制页面地址');
            var menuPos = menu.offset();
            tooltip.css({
                'left': menuPos.left + menu.outerWidth() + 10,
                'top': menuPos.top
            }).stop().css('opacity', 1)
              .delay(1500)
              .animate({opacity: 0}, 500);
            return true;
        } else {
            throw new Error('复制失败');
        }
    } catch (err) {
        $('.copy-tooltip').text('复制失败').css({
            'background': 'rgba(255,0,0,0.7)',
            'left': $('.usercm').offset().left + $('.usercm').outerWidth() + 10,
            'top': $('.usercm').offset().top
        }).stop().css('opacity', 1)
          .delay(1500)
          .animate({opacity: 0}, 500);
        return false;
    }
}
    
    
</script>

无对应主题,打开你主题文件找到footer.php 把下面代码复制上去

<style type="text/css">
    /* 基础样式重置 */
    a {
        text-decoration: none;
        color: inherit;
    }
    
    /* 菜单容器 - 修复版 */
div.usercm {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(15px) saturate(180%);
    -webkit-backdrop-filter: blur(15px) saturate(180%);
    font-size: 14px;
    width: 160px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    position: absolute;
    display: none;
    z-index: 10000;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    
    /* 新的描边方案 */
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        0 0 0 0px rgba(44, 123, 229, 0); /* 初始状态 */
}

/* 鼠标悬停时通过box-shadow添加描边 */
div.usercm:hover {
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        0 0 0 2px rgba(44, 123, 229, 0.5);
}
    
    /* 菜单列表 */
    div.usercm ul {
        list-style: none;
        margin: 0;
        padding: 5px 0;
    }
    
    /* 菜单项 */
    div.usercm ul li {
        margin: 0;
        padding: 0;
        transition: all 0.2s ease;
    }
    
    /* 菜单链接 */
    div.usercm ul li a {
        color: #555;
        padding: 10px 20px; /* 增加内边距 */
        display: flex;
        align-items: center;
        transition: all 0.2s ease;
    }
    
    /* 菜单图标 */
    div.usercm ul li a i {
        width: 20px;
        margin-right: 12px;
        text-align: center;
        color: #666;
    }
    
    /* 悬停效果 */
    div.usercm ul li:hover {
        background: rgba(100, 149, 237, 0.2); /* 更强的悬停效果 */
    }
    
    div.usercm ul li a:hover {
        color: #2c7be5;
    }
    
    div.usercm ul li a:hover i {
        color: #2c7be5;
    }
    
    /* 分隔线 */
div.usercm ul li.divider {
    height: 1px;
    background: transparent;
    border-top: 1px dashed #2c7be5;
    margin: 8px 15px;
    opacity: 0.6;
}

div.usercm ul li.divider:hover {
    opacity: 1;
}
    
    /* 禁用状态 */
    a.disabled {
        color: rgba(204, 204, 204, 0.7) !important; /* 半透明禁用状态 */
        cursor: not-allowed;
    }
    
    a.disabled:hover {
        background-color: transparent !important;
    }
    
      /* 透明风格的顶部导航容器 */
    .quick-nav {
        display: flex;
        justify-content: space-around;
        padding: 10px 10px;
        background: transparent; /* 完全透明背景 */
        border-bottom: 1px solid rgba(255, 255, 255, 0.1); /* 极细的分隔线 */
        margin-bottom: 5px;
    }
    
    /* 透明导航按钮基础样式 */
    .quick-nav a {
        padding: 8px 12px;
        border-radius: 6px;
        transition: all 0.25s ease;
        color: rgba(85, 85, 85, 0.9); /* 半透明文字 */
        font-size: 15px;
        background: transparent; /* 透明背景 */
    }
    
    /* 悬停效果 - 优雅的淡入背景 */
    .quick-nav a:hover {
        background: rgba(100, 149, 237, 0.15); /* 轻微蓝色背景 */
        color: #2c7be5; /* 悬停时文字变蓝 */
    }
    
    /* 点击效果 */
    .quick-nav a:active {
        background: rgba(100, 149, 237, 0.25); /* 点击时背景加深 */
        transform: scale(0.98); /* 轻微缩小效果 */
    }
    
    /* 图标动画 */
    .quick-nav a i {
        transition: transform 0.2s ease;
    }
    
    .quick-nav a:hover i {
        transform: scale(1.1); /* 悬停时图标轻微放大 */
    }
    
    /* 按钮边框动画 (可选) */
    .quick-nav a {
        position: relative;
    }
    
    .quick-nav a::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        border-radius: 6px;
        border: 1px solid transparent;
        transition: border-color 0.3s ease;
    }
    
    .quick-nav a:hover::after {
        border-color: rgba(100, 149, 237, 0.3); /* 悬停时显示淡淡边框 */
    }
    
    .copy-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 10001;
    white-space: nowrap;
    }
</style>


<div class="usercm" style="display: none;">
    <!-- 新增的顶部导航图标 -->
    <div class="quick-nav">
        <a href="javascript:history.go(-1);" rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  title="返回上一页"><i class="fa fa-arrow-left"></i></a>
        <a href="javascript:history.go(1);" rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  title="返回下一页"><i class="fa fa-arrow-right"></i></a>
        <a href="javascript:smoothScrollToTop();" rel="external nofollow"  rel="external nofollow"  title="返回顶部"><i class="fa fa-arrow-up"></i></a>
    </div>
    
    <ul>
        <li><a href="https://www.xkzhi.com/frieds"><i class="fa fa-meh-o fa-fw"></i><span>成为邻居</span></a></li>
        <li class="divider"></li>
        <li><a href="javascript:void(0);" rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  onclick="getSelect();"><i class="fa fa-copy"></i><span>复制内容</span></a></li>
        <li><a href="javascript:window.location.reload();" rel="external nofollow"  rel="external nofollow" ><i class="fa fa-refresh fa-fw"></i><span>刷新页面</span></a></li>
        <li class="divider"></li>
        <li><a href="https://www.xkzhi.com/"><i class="fa fa-home"></i><span>返回首页</span></a></li>
        <li><a href="javascript:history.go(1);" rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow" ><i class="fa fa-arrow-right"></i><span>前进</span></a></li>
        <li><a href="javascript:history.go(-1);" rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow" ><i class="fa fa-arrow-left"></i><span>后退</span></a></li>
        <li class="divider"></li>
        <li><a href="javascript:void(0);" rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  onclick="copyPageUrl();"><i class="fa fa-link"></i><span>复制地址</span></a></li>
        <li><a href="javascript:void(0);" rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  onclick="baiduSearch();"><i class="fa fa-search"></i><span>搜索选中内容</span></a></li>
    </ul>
</div>

<script type="text/javascript">
//顶部
let scrollAnimationId = null;

function smoothScrollToTop() {
    
    if (scrollAnimationId) {
        cancelAnimationFrame(scrollAnimationId);
    }
    
    const startPosition = window.pageYOffset;
    const startTime = performance.now();
    const duration = 800; // 动画持续时间(ms)
    
    const animateScroll = (currentTime) => {
        const elapsed = currentTime - startTime;
        const progress = Math.min(elapsed / duration, 1);
        
        // 使用缓动函数使滚动更自然
        const easeProgress = easeOutCubic(progress);
        
        window.scrollTo(0, startPosition * (1 - easeProgress));
        
        if (progress < 1) {
            scrollAnimationId = requestAnimationFrame(animateScroll);
        } else {
            scrollAnimationId = null;
        }
    };
    
    // 缓动函数 - 平滑减速
    function easeOutCubic(t) {
        return (--t) * t * t + 1;
    }
    
    // 监听用户滚动中断
    const handleUserScroll = () => {
        if (scrollAnimationId) {
            cancelAnimationFrame(scrollAnimationId);
            scrollAnimationId = null;
            window.removeEventListener('wheel', handleUserScroll);
            window.removeEventListener('touchmove', handleUserScroll);
        }
    };
    
    window.addEventListener('wheel', handleUserScroll, { passive: true });
    window.addEventListener('touchmove', handleUserScroll, { passive: true });
    
    scrollAnimationId = requestAnimationFrame(animateScroll);
}

    // 保持原有功能不变
    (function(a) {
        a.extend({
            mouseMoveShow: function(b) {
                var d = 0,
                    c = 0,
                    h = 0,
                    k = 0,
                    e = 0,
                    f = 0;
                    
                var menu = a(b);
                var isMenuShowing = false;
                var isOnImage = false;
                var imageUrl = '';
                
                // 创建提示框元素
                var tooltip = $('<div class="copy-tooltip">复制成功</div>').css({
                    'position': 'absolute',
                    'background': 'rgba(0,0,0,0.7)',
                    'color': 'white',
                    'padding': '5px 10px',
                    'border-radius': '4px',
                    'font-size': '12px',
                    'opacity': '0',
                    'transition': 'opacity 0.3s',
                    'pointer-events': 'none',
                    'z-index': '10001'
                }).appendTo('body');
                
                // 添加CSS过渡效果
                menu.css({
                    'transition': 'left 0.3s ease, top 0.3s ease'
                });
                
                // 检测是否在图片上
                function checkIfOnImage(target) {
                    var imgElement = target.closest('img');
                    if (imgElement) {
                        isOnImage = true;
                        imageUrl = imgElement.src;
                        // 修改"成为邻居"为"复制图片链接"
                        menu.find('a[href="https://www.xkzhi.com/frieds"] i')
                            .removeClass('fa-meh-o')
                            .addClass('fa-link');
                        menu.find('a[href="https://www.xkzhi.com/frieds"] span')
                            .text('复制此图片');
                    } else {
                        isOnImage = false;
                        imageUrl = '';
                        // 恢复"成为邻居"
                        menu.find('a[href="https://www.xkzhi.com/frieds"] i')
                            .removeClass('fa-link')
                            .addClass('fa-meh-o');
                        menu.find('a[href="https://www.xkzhi.com/frieds"] span')
                            .text('成为邻居');
                    }
                }
                
                // 复制图片链接函数
                function copyImageUrl() {
                    if (!isOnImage || !imageUrl) return false;
                    
                    try {
                        var tempInput = document.createElement('input');
                        tempInput.value = imageUrl;
                        document.body.appendChild(tempInput);
                        tempInput.select();
                        var success = document.execCommand('copy');
                        document.body.removeChild(tempInput);
                        
                        if (success) {
                            // 显示提示框
                            var menuPos = menu.offset();
                            tooltip.css({
                                'left': menuPos.left + menu.outerWidth() + 10,
                                'top': menuPos.top
                            }).stop().css('opacity', 1)
                              .delay(1500)
                              .animate({opacity: 0}, 500);
                            return true;
                        } else {
                            throw new Error('复制失败');
                        }
                    } catch (err) {
                        tooltip.text('复制失败').css({
                            'background': 'rgba(255,0,0,0.7)',
                            'left': menu.offset().left + menu.outerWidth() + 10,
                            'top': menu.offset().top
                        }).stop().css('opacity', 1)
                          .delay(1500)
                          .animate({opacity: 0}, 500);
                        return false;
                    }
                }
                
                a(window).mousemove(function(g) {
                    d = a(window).width();
                    c = a(window).height();
                    h = g.clientX;
                    k = g.clientY;
                    e = g.pageX;
                    f = g.pageY;
                    
                    // 调整位置防止超出窗口
                    h + menu.width() >= d && (e = e - menu.width() - 5);
                    k + menu.height() >= c && (f = f - menu.height() - 5);
                    
                    a("html").on({
                        contextmenu: function(c) {
                            if (3 == c.which) {
                                checkIfOnImage(c.target);
                                
                                if (isMenuShowing) {
                                    // 菜单已显示,平滑移动到新位置
                                    menu.css({
                                        left: e,
                                        top: f
                                    });
                                } else {
                                    // 菜单未显示,显示菜单
                                    menu.css({
                                        left: e,
                                        top: f
                                    }).show();
                                    isMenuShowing = true;
                                }
                                c.preventDefault(); // 阻止默认右键菜单
                            }
                        },
                        click: function() {
                            menu.hide();
                            isMenuShowing = false;
                        }
                    });
                });
                
                // 修改"成为邻居"的点击事件
                menu.on('click', 'a[href="https://www.xkzhi.com/frieds"]', function(e) {
                    if (isOnImage && imageUrl) {
                        e.preventDefault();
                        copyImageUrl();
                        menu.hide();
                        isMenuShowing = false;
                    }
                });
                
                // 新增:滚动时隐藏菜单
                a(window).scroll(function() {
                    menu.hide();
                    isMenuShowing = false;
                });
            },
            disabledContextMenu: function() {
                window.oncontextmenu = function() {
                    return !1
                }
            }
        })
    })(jQuery);
 
    function getSelect() {
        "" == (window.getSelection ? window.getSelection() : document.selection.createRange().text) ? layer.msg("请先选择要复制的内容!") : document.execCommand("Copy")
    }
    
    function baiduSearch() {
        var a = window.getSelection ? window.getSelection() : document.selection.createRange().text;
        "" == a ? layer.msg("请先选择要搜索的内容!") : window.open("https://www.xkzhi.com/?s=" + a)
    }
    
    $(function() {
        for (var a = navigator.userAgent, b = "Android;iPhone;SymbianOS;Windows Phone;iPad;iPod".split(";"), d = !0, c = 0; c < b.length; c++) if (0 < a.indexOf(b[c])) {
            d = !1;
            break
        }
        d && ($.mouseMoveShow(".usercm"), $.disabledContextMenu())
    });
    
    // 复制当前页面地址函数
    function copyPageUrl() {
    try {
        var tempInput = document.createElement('input');
        tempInput.value = window.location.href;
        document.body.appendChild(tempInput);
        tempInput.select();
        var success = document.execCommand('copy');
        document.body.removeChild(tempInput);
        
        if (success) {
            // 显示提示框
            var menu = $('.usercm');
            var tooltip = $('.copy-tooltip').text('已复制页面地址');
            var menuPos = menu.offset();
            tooltip.css({
                'left': menuPos.left + menu.outerWidth() + 10,
                'top': menuPos.top
            }).stop().css('opacity', 1)
              .delay(1500)
              .animate({opacity: 0}, 500);
            return true;
        } else {
            throw new Error('复制失败');
        }
    } catch (err) {
        $('.copy-tooltip').text('复制失败').css({
            'background': 'rgba(255,0,0,0.7)',
            'left': $('.usercm').offset().left + $('.usercm').outerWidth() + 10,
            'top': $('.usercm').offset().top
        }).stop().css('opacity', 1)
          .delay(1500)
          .animate({opacity: 0}, 500);
        return false;
    }
}
    
    
</script>

5、子比主题 – 文章主内容详细信息样式

效果

图片[1]-子比主题 – 文章主内容详细信息样式[修复]

更新日志

  • 修复下载按钮自动跳转子比的付费阅读、付费下载等等功能
  • 修复没有开启付费阅读、付费下载等不显示文章顶部显示下载

代码部署

方案一:定位:/wp-content/themes/zibll/func.php文件,没有这个文件自己创建一个,记得加上php头,要不然会报错,然后将下面的代码放到里面,其实下面的代码是放到metabox-options.php文件里面的,但是方便就放到func.php里面吧,修复版本这个代码不变

if (class_exists('CSF')) {
    CSF::createMetabox('zib_post_extra', array(
        'title'      => '文章额外信息',
        'post_type'  => array('post'),
        'context'    => 'advanced',
        'data_type'  => 'unserialize',
    ));

    $fields = array();

    $fields[] = array(
        'id'      => 'zib_platform',
        'type'    => 'select',
        'title'   => '平台',
        'options' => array(
            'android' => 'Android',
            'ios'     => 'iOS',
            'windows' => 'Windows',
            'mac'     => 'Mac',
            'linux'   => 'Linux',
            'other'   => '其他',
        ),
        'default' => 'android'
    );

    $fields[] = array(
        'id'    => 'zib_size',
        'type'  => 'text',
        'title' => '文件大小',
        'desc'  => '如:21.3M'
    );

    $fields[] = array(
        'id'    => 'zib_version',
        'type'  => 'text',
        'title' => '文件版本',
        'desc'  => '如:v3.3.7'
    );

    $fields[] = array(
        'id'    => 'zib_language',
        'type'  => 'text',
        'title' => '语言',
        'desc'  => '如:简体中文'
    );

    $fields[] = array(
        'id'      => 'zib_license_type',
        'type'    => 'select',
        'title'   => '授权类型',
        'options' => array(
            'free'      => '免费版',
            'modified'  => '修改版',
            'official'  => '官方版',
            'other'     => '其他',
        ),
        'default' => 'official'
    );

    $fields[] = array(
        'id'      => 'zib_recommend_star',
        'type'    => 'select',
        'title'   => '推荐星级',
        'options' => array(
            '1' => '★☆☆☆☆',
            '2' => '★★☆☆☆',
            '3' => '★★★☆☆',
            '4' => '★★★★☆',
            '5' => '★★★★★',
        ),
        'default' => '5'
    );

    CSF::createSection('zib_post_extra', array('fields' => $fields));
}
add_action('admin_head', function() {
    echo '<style>
    .csf-metabox .csf-field { margin-bottom: 6px !important; }
    .csf-metabox .csf-field .csf-title { margin-bottom: 2px !important; }
    .csf-metabox .csf-field + .csf-field { border-top: none !important; }
    </style>';
});

方案二:定位:/wp-content/themes/ZibTF/inc/functions/zib-single.php,那么这个文件就是子比的页面的文件,然后我们找到下面的函数,大约在157行,如下图,修复版本这个代码要变,直接替换原版的就可

图片[2]-子比主题 – 文章主内容详细信息样式[修复]

方案三:把这整个函数全部替换成下面的代码,因为我改了里面的代码,你直接替换就行,记得备份一下,方便后面好更新,如果有子主题的话当我没说!

CSS代码我就不多说了,直接丢到:子比主题–>>自定义CSS样式即可,修复版本css代码不动

/*文章顶部*/
        .mobile-content {
            display: none;
        }
        .pc-content {
            display: block;
        }
        @media (max-width: 768px) { /* 假设768px以下是移动端 */
            .mobile-content {
                display: block;
            }
            .pc-content {
                display: none;
            }
        }
.w820 {width: 100%;}
.pad20 {padding: 20px;}
.bgW {background-color: #fff;}

.ovf {overflow: hidden;}

body, input, textarea {font: 14px 'FAE\8F6F\96C5\9ED1';}
.ovf {overflow: hidden;}

.tjApp .app-info .appImg {margin-right: 20px;}
.tjApp .app-info img {width: 85px;height: 85px;display: block;border-radius: 10px;}
.fl {float: left;}
.tjApp .app-info div.fl {width: 490px;}
.tjApp .app-info .appName {color: var(--header-color);font-size: 20px;margin: 10px 0 15px 0;white-space: nowrap;text-overflow: ellipsis;overflow: hidden;max-width: 490px;}
.tjApp .app-info .label {color: #333;font-size: 14px;}
.tjApp .detaBox {margin-top: 10px;}
.tjApp .detaBox .detaMain {width: 470px;}
.fr {
    float: right;
}
.tjApp .detaBox .downloadBtn a {
    width: 200px;
    height: 50px;
    text-align: center;
    line-height: 50px;
    color: #fff;
    background: #008ded;
    display: block;
    font-size: 20px;
    margin: 0px auto 0 auto;
    border-radius: 3px;
}
a:link, a:visited {
    text-decoration: none;
}
.tjApp .app-info .article-share {
    margin-top: 10px;
}
.article-share {
    color: #333;
    line-height: 25px;
}
.article-share span {
    margin-top: 1px;
}
.tjApp .app-info .article-share div.fl {
    width: auto;
}
.tjApp .detaBox .detaMain p {
    float: left;
    width: 32%;
    height: 30px;
    line-height: 30px;
    color: var(--header-color);
    overflow: hidden;
    white-space: nowrap;
}
p {
    margin: 0;
    padding: 0;
    font-size: 100%;
    vertical-align: baseline;
    border: 0;
    outline: 0;
}.enlighter-default .enlighter{max-height:400px;overflow-y:auto !important;}.posts-item .item-heading>a {font-weight: bold;color: unset;}@media (max-width:640px) {
    .meta-right .meta-view{
      display: unset !important;
    }
  }

.mobile-info-grid {
    display: flex;
    flex-wrap: wrap;
    margin-top: 10px;
}
.mobile-info-grid > div {
    width: 50%;
    box-sizing: border-box;
    padding: 2px 0;
    font-size: 14px;
    color: #333;
    line-height: 1.6;
}
@media (min-width: 768px) {
    .mobile-info-grid { display: none; }
}

修复版本要多加一个JS代码,直接丢到:子比主题–>>自定义javascript代码

function scrollToTarget() {
  var target = document.querySelector('.box-body.relative');
  if (target) {
    var rect = target.getBoundingClientRect();
    var scrollTop = window.pageYOffset || document.documentElement.scrollTop;
    var offset = 100; 
    window.scrollTo({
      top: rect.top + scrollTop - offset,
      behavior: 'smooth'
    });
  }
}

6、子比主题美化-资源下载按钮增加UC网盘

效果预览

图片[1]-子比主题美化-资源下载按钮增加UC网盘(其他网盘可参考)

教程开始

1.路径 /wp-content/themes/zibll/inc/options/options.php

在35行下面的任意一行增加 

'zibsvg-uc',

2.路径 /wp-content/themes/zibll/js/svg-icon.js

在95行 zib_svgs[‘qwqw’] = ”; 的上方插入如下代码

zib_svgs['uc'] = '<path d="M331.817056 0c27.812837 7.968953 57.348664 12.297928 83.151513 24.508856 140.651176 66.55861 178.100956 220.556708 87.01449 350.513947-32.105812 45.811732-76.281553 77.477546-122.330284 107.341371-34.342799 22.273869-69.469593 43.702744-101.719404 68.755597-69.97759 54.365681-109.711357 125.728263-109.558358 215.820735 0.189999 112.987338 65.548616 206.907788 169.338008 246.761554 4.618973 1.77099 7.989953 6.78796 11.94293 10.29294h-32.111812c-26.147847-4.814972-52.626692-8.299951-78.38754-14.675914C132.709222 982.97024 60.129648 916.799628 21.183876 815.442222 9.306945 784.528403 6.79996 750.016605 0 717.152798v-21.407875c0.994994-6.981959 2.260987-13.943918 2.941983-20.957877 4.238975-43.696744 13.525921-86.842491 37.933777-123.215278 31.307817-46.658727 67.621604-89.947473 101.478406-134.912209 19.243887-25.56085 40.584762-50.044707 56.21967-77.707545 29.586827-52.347693 22.277869-111.232348-14.517914-148.745128-36.205788-36.912784-93.731451-44.197741-147.133138-18.236894C26.581844 176.998963 16.914901 183.416925 6.937959 189.193891c1.161993-9.369945 4.628973-16.563903 8.889948-23.252863C55.311676 103.959391 109.663357 58.440658 176.437966 29.546827 208.625778 15.618908 244.237569 9.599944 278.298369 0h53.518687z" p-id="5626"></path><path d="M463.830282 1023.994c6.663961-4.863972 12.762925-10.901936 20.077883-14.403916 75.945555-36.356787 120.826292-95.219442 126.29026-179.970945 5.455968-84.717504-40.295764-163.76304-112.74534-196.702847-84.550505-38.437775-163.977039-29.839825-236.148616 30.68282-4.020976 3.36998-7.861954 6.950959-15.165911 9.007947 2.118988-5.897965 3.47198-12.219928 6.466962-17.634897 45.339734-81.94952 135.588206-120.591293 234.952623-100.827409 150.075121 29.850825 247.092552 175.994969 217.183728 327.443081-3.316981 16.775902-7.770954 33.330805-12.08793 51.650698 55.187677 5.929965 109.550358 14.068918 138.474189 75.814556-34.566797 2.766984-65.661615 6.041965-96.839432 7.560955-46.870725 2.285987-93.80445 3.270981-140.703176 4.999971-6.403962 0.232999-12.766925 1.557991-19.147888 2.379986H463.830282z" p-id="5627"></path><path d="M1023.994 685.040986c-51.1907-18.687891-98.710422-7.608955-145.933145 15.474909-34.978795 17.0989-72.626574 22.881866-110.84735 10.981936-7.566956-2.358986-15.691908-8.870948-19.733885-15.724908-73.30957-124.400271-178.486954-194.375861-326.116089-192.88287-3.276981 0.031-6.557962-0.353998-9.835942-0.547996-0.429997-1.68299-0.854995-3.36898-1.281993-5.051971 12.731925-4.135976 25.211852-9.505944 38.243776-12.194928 63.250629-13.055924 125.215266-4.238975 186.720906 12.011929 49.371711 13.044924 94.570446 35.105794 136.981197 62.983631 47.72072 31.369816 99.832415 49.216712 156.653083 53.780685 7.094958 0.570997 14.145917 1.807989 21.185875 2.946983 33.771802 5.456968 60.361646 20.813878 73.964567 53.950684l-0.001 14.271916zM546.627797 433.099462c34.856796-16.048906 70.483587-30.64182 104.337389-48.584715 28.718832-15.215911 55.478675-34.1528 82.919514-51.737697 10.772937-6.90596 14.718914-16.793902 14.843913-30.107823 0.341998-36.103788 7.949953-70.766585 26.653844-102.222401 4.448974-7.478956 10.16394-14.201917 16.103905-22.390869 26.383845 23.504862 37.950778 53.149689 45.395734 84.316506 3.166981 13.270922 8.885948 19.500886 21.661873 24.037859 120.915292 42.891749 163.76204 150.24612 160.971057 245.413562-0.173999 5.929965-7.771954 14.877913-13.778919 16.895901-52.145694 17.535897-104.03439 16.406904-154.152097-7.505956-49.228712-23.482862-97.023432-50.204706-147.139138-71.528581-47.098724-20.044883-97.162431-31.245817-148.957127-31.877813-2.744984-0.03-5.483968-0.630996-8.223952-0.964995-0.213999-1.248993-0.422998-2.495985-0.635996-3.742978zM398.959662 669.996074c83.173513 0.077 149.929122 66.55061 150.002121 149.368125 0.073 82.748515-66.51161 149.562124-149.544123 150.064121-83.513511 0.497997-151.015115-66.873608-150.783117-150.497118 0.229999-82.893514 66.962608-149.011127 150.325119-148.935128z m66.053613 149.714123c0.021-37.118783-30.138823-67.512604-66.611609-67.128607-36.730785 0.382998-66.808609 30.981818-66.54961 67.695604 0.251999 35.487792 30.67382 66.052613 66.229611 66.53261 36.394787 0.495997 66.910608-30.099824 66.931608-67.099607z" p-id="5628"></path>';

3.路径  /wp-content/themes/zibll/zibpay/functions/zibpay-download.php

约340行 后面加入下方代码

elseif (stripos($down_v['link'], 'uc')) {
            $down_name = $down_v['name'] ? $down_v['name'] : 'UC网盘';
            $class .= ' b-blue';
            $icon = zib_get_svg('uc');
        }

图片[2]-子比主题美化-资源下载按钮增加UC网盘(其他网盘可参考)

© 版权声明

美化笔记·LOGO扫描·在线人数·卡片工具· 右键菜单·资源下载按钮-春眠不觉晓
美化笔记·LOGO扫描·在线人数·卡片工具· 右键菜单·资源下载按钮
此内容为付费资源,请付费后查看
100积分
付费资源
THE END
点赞11 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容