文章列表图片

Vela 主题设置 · 分区:文章列表 · 上级分区:wenzhang · 选项 ID:post_xzfd · 类型:switcher

依赖:仅当 'post_ll', '!=', '' 满足时才显示/生效。

文章列表图片

功能简介

注意,水波上浮与悬停上浮只能选择一个喔~

适用场景

  • 当你希望「注意,水波上浮与悬停上浮只能选择一个喔~」生效时,开启本设置即可,无需改动主题文件。
  • 适用于需要在不写代码的前提下,快速为站点追加「文章列表图片」相关表现的场景。
  • 若同一页面存在多个相似美化项,建议只开启其一,避免视觉冲突。

代码实现

📂 文件创建清单

文件 是否需新建 完整存放路径 / 所属文件夹
sections.php 否(已存在) /zibll_child/includes/acg/sections.php —— 「文章列表」分区的 fields 数组
本设置项 post_xzfd 作为 sections.phpfields 数组的一项,无需单独建文件

无需新建任何 PHP / JS / CSS 文件。本设置是 Vela 主题设置页的一个开关,字段已写在 /zibll_child/includes/acg/sections.php(相对路径 zibll_child/includes/acg/sections.php)的「文章列表」分区(上级分区:wenzhang)。开启后,前端通过 vela_get_option('post_xzfd') 读取开关状态,由 includes/acg/ 模块输出对应样式类或加载美化资源。

📁 本段代码存放文件

以下 CSF 字段定义 需放在 /zibll_child/includes/acg/sections.phpzibll_child/includes/acg/sections.php)的「文章列表」分区的 fields 数组中(该项已存在,无需重复添加;若你要新增同类设置,照此格式在对应分区追加即可)。

开关注册代码(CSF 字段定义)

array(
            array(
                'title'   => '文章列表图片',
                'label'   => '列表、卡片图片倾斜放大',
                'id'      => 'post_xzfd',
                'default' => false,
                'type'    => 'switcher',
            ),
                array(
                'title'   => '隐藏首页文章发布时间',
                'label'   => '开启后用户将不能在首页看到文章的发布时间,文章页面还是可以看到的',
                'id'      => 'zibll_post_public_date',
                'default' => false,
                'type'    => 'switcher',
            ),
                array(
                'title'   => '首页文章列表悬停上浮',
                'label'   => '开启后给网站首页文章赋予悬停上浮特效',
                'id'      => 'posts_item',
                'default' => false,
                'type'    => 'switcher',
            ),
              array(
                'title'   => '首页文章列表水波上浮',
                'label'   => '开启后给网站首页文章赋予悬停上浮特效',
                'desc'    => '注意,水波上浮与悬停上浮只能选择一个喔~',
                'id'      => 'posts_item2',
                'default' => false,
                'type'    => 'switcher',
            ),
                array(
                'title'   => '首页文章点击更多美化',
                'label'   => '启用后,美化文章的“点击更多”按钮',
                'id'      => 'dianjigengduo',
                'default' => false,
                'type'    => 'switcher',
            ),
            array(
            'title'   => '文章列表悬停萝莉',
            'label'    => '开启后文章列表悬停萝莉',
            'id'      => 'post_ll',
            'type'    => 'switcher',
            'default' => false,
        ),
        array(
                'title'   => ' ',
                'desc'    =>'悬停图片',
                'dependency' => array('post_ll', '!=', ''),
                'id'      => 'post_ll_img',
                'class'    =>'compact',
                'default' => $img . 'decorate1.png',
                'type'    => 'switcher',
                'preview' => true,
                'library' => 'image', 
                'type' => 'upload',
            ),
            array(
            'dependency' => array('post_ll', '!=', ''),
            'title'   => '滑动时间',
            'id'      => 'post_ll_s',
            'default' => 0.5,
            'min'     => 0,
            'max'     => 10,
            'step'    => 0.1,
            'unit'    => '秒',
            'type'    => 'spinner',
        ),
      )

使用示例

  1. 后台 外观 → Vela主题设置 → 文章列表,找到「文章列表图片」开关并打开,保存设置。
  2. 回到前台对应页面,即可看到效果(部分项仅 PC 端或仅子比主题生效,详见说明)。
  3. 在主题或插件代码中读取该设置:
$on = vela_get_option('post_xzfd', false);
if ($on) {
    // 开关已开启,自定义逻辑
}
© 版权声明
THE END
喜欢就支持一下吧
点赞7 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容