feat(frontend): replace article system with Zibll 9.0

This commit is contained in:
kate522 committed 2026-08-18 16:06:47 +08:00
1 parent 2881c69e9c
commit 0f2ac6c34a
69 files changed
+2603 -4163

No files matched your search

+117 -261
View File
@@ -9,265 +9,121 @@ defined('ABSPATH') || exit;
class SchemaPostListList {
public static function build(): array {
return [
'key' => 'list',
'title' => '文章列表',
'version' => '2.0.0',
'option_key' => 'aksrt_settings',
'groups' => [
[
'key' => 'order',
'title' => '默认排序与置顶',
'fields' => [
[
'key' => 'list_orderby',
'label' => '默认排序方式',
'type' => 'radio',
'default' => 'modified',
'options' => [
['label' => '发布时间', 'value' => 'date'],
['label' => '更新时间', 'value' => 'modified'],
['label' => 'WP默认', 'value' => 'default'],
],
'help' => '文章列表全局默认排序(对齐 Zibll list_orderby)',
],
[
'key' => 'sticky_s',
'label' => '显示置顶文章',
'type' => 'checkbox',
'default' => ['home', 'cat'],
'options' => [
['label' => '首页', 'value' => 'home'],
['label' => '分类页', 'value' => 'cat'],
['label' => '标签页', 'value' => 'tag'],
],
],
],
],
[
'key' => 'display',
'title' => '列表显示',
'fields' => [
[
'key' => 'target_blank',
'label' => '新窗口打开文章',
'type' => 'switch',
'default' => false,
],
[
'key' => 'item_heading_bold',
'label' => '列表标题粗体显示',
'type' => 'switch',
'default' => false,
],
[
'key' => 'post_list_author',
'label' => '显示文章作者',
'type' => 'switch',
'default' => true,
],
[
'key' => 'post_list_time',
'label' => '显示文章时间',
'type' => 'switch',
'default' => true,
'help' => '建议作者与时间至少开启一项',
],
[
'key' => 'list_meta_show',
'label' => '列表小部件(移动端优先)',
'type' => 'radio',
'default' => 'like',
'options' => [
['label' => '阅读量', 'value' => 'view'],
['label' => '点赞数', 'value' => 'like'],
['label' => '评论', 'value' => 'comm'],
],
'help' => '移动端空间不足时始终保留的部件',
],
[
'key' => 'list_badge_show',
'label' => '列表徽章',
'type' => 'checkbox',
'default' => ['pay', 'tag', 'cat'],
'options' => [
['label' => '付费', 'value' => 'pay'],
['label' => '分类', 'value' => 'cat'],
['label' => '标签', 'value' => 'tag'],
],
],
],
],
[
'key' => 'paging',
'title' => '列表翻页',
'fields' => [
[
'key' => 'paging_ajax_s',
'label' => '列表翻页模式',
'type' => 'radio',
'default' => '1',
'options' => [
['label' => 'AJAX 追加列表翻页', 'value' => '1'],
['label' => '数字翻页按钮', 'value' => '0'],
],
'help' => '对齐 Zibll paging_ajax_s;单页数量仍受 WP 阅读设置影响',
],
[
'key' => 'paging_ajax_ias_s',
'label' => 'AJAX 自动加载',
'type' => 'switch',
'default' => true,
'dependsOn' => ['key' => 'paging_ajax_s', 'value' => '1'],
'help' => '滚动到列表尽头时自动加载下一页(Zibll paging_ajax_ias_s)',
],
[
'key' => 'ias_max',
'label' => '自动加载页数',
'type' => 'number',
'default' => 3,
'min' => 0,
'max' => 10,
'dependsOn' => ['key' => 'paging_ajax_s', 'value' => '1'],
'help' => '0 表示不限制,直到加载完全部列表',
],
[
'key' => 'ajax_trigger',
'label' => '加载更多文案',
'type' => 'input',
'default' => '加载更多',
'dependsOn' => ['key' => 'paging_ajax_s', 'value' => '1'],
],
[
'key' => 'ajax_nomore',
'label' => '没有更多文案',
'type' => 'input',
'default' => '没有更多了',
'dependsOn' => ['key' => 'paging_ajax_s', 'value' => '1'],
],
],
],
[
'key' => 'card',
'title' => '卡片与布局',
'fields' => [
[
'key' => 'post_card_style',
'label' => '默认列表模式',
'type' => 'select',
'default' => 'thumb',
'options' => [
['label' => '列表图文模式', 'value' => 'thumb'],
['label' => '紧凑卡', 'value' => 'compact'],
['label' => '大图卡', 'value' => 'large_thumb'],
['label' => '多图卡', 'value' => 'multi_thumb'],
['label' => '列表文字模式', 'value' => 'text'],
['label' => '列表自动图文', 'value' => 'thumb_if_has'],
['label' => '卡片模式', 'value' => 'card'],
],
],
[
'key' => 'post_excerpt_length',
'label' => '摘要长度',
'type' => 'number',
'default' => 120,
'min' => 20,
'max' => 500,
],
[
'key' => 'post_list_per_page',
'label' => '每页文章数',
'type' => 'number',
'default' => 12,
'min' => 4,
'max' => 48,
],
[
'key' => 'list_show_type',
'label' => '列表间距样式',
'type' => 'radio',
'default' => 'separate',
'options' => [
['label' => '分隔卡片', 'value' => 'separate'],
['label' => '无间距', 'value' => 'no_margin'],
],
],
[
'key' => 'list_list_style',
'label' => '列表样式变体',
'type' => 'radio',
'default' => '',
'options' => [
['label' => '默认', 'value' => ''],
['label' => '样式2', 'value' => 'style2'],
],
],
[
'key' => 'list_list_img_position',
'label' => '列表缩略图位置',
'type' => 'radio',
'default' => 'left',
'options' => [
['label' => '左侧', 'value' => 'left'],
['label' => '右侧', 'value' => 'right'],
],
],
[
'key' => 'list_list_scale',
'label' => '列表缩略图比例 (%)',
'type' => 'number',
'default' => 70,
'min' => 50,
'max' => 200,
],
[
'key' => 'list_card_style',
'label' => '卡片样式变体',
'type' => 'radio',
'default' => '',
'options' => [
['label' => '默认', 'value' => ''],
['label' => '样式3', 'value' => 'style3'],
],
],
[
'key' => 'list_card_scale',
'label' => '卡片缩略图比例 (%)',
'type' => 'number',
'default' => 70,
'min' => 20,
'max' => 200,
],
[
'key' => 'list_card_home',
'label' => '首页卡片模式',
'type' => 'switch',
'default' => false,
],
[
'key' => 'list_card_cat',
'label' => '分类卡片模式',
'type' => 'taxonomy_select',
'taxonomy' => 'category',
'multiple' => true,
'default' => [],
],
[
'key' => 'list_card_tag',
'label' => '标签页卡片模式',
'type' => 'switch',
'default' => false,
],
[
'key' => 'list_card_author',
'label' => '用户页卡片模式',
'type' => 'switch',
'default' => false,
],
],
],
],
];
}
public static function build(): array {
return [
'key' => 'list',
'title' => '文章列表',
'version' => '9.0.0',
'option_key' => 'aksrt_settings',
'groups' => [
[
'key' => 'order',
'title' => '默认排序与置顶',
'fields' => [
['key' => 'list_orderby', 'label' => '默认排序方式', 'type' => 'radio', 'default' => 'modified', 'options' => [
['label' => '发布时间', 'value' => 'date'],
['label' => '更新时间', 'value' => 'modified'],
['label' => 'WP默认', 'value' => 'default'],
]],
['key' => 'post_time_source', 'label' => '时间显示数据源', 'type' => 'radio', 'default' => 'modified', 'options' => [
['label' => '发布时间', 'value' => 'date'],
['label' => '更新时间', 'value' => 'modified'],
]],
['key' => 'sticky_s', 'label' => '显示置顶文章', 'type' => 'checkbox', 'default' => ['home', 'cat'], 'options' => [
['label' => '首页', 'value' => 'home'],
['label' => '分类页', 'value' => 'cat'],
['label' => '标签页', 'value' => 'tag'],
]],
],
],
[
'key' => 'display',
'title' => '列表显示',
'fields' => [
['key' => 'target_blank', 'label' => '新窗口打开文章', 'type' => 'switch', 'default' => false],
['key' => 'item_heading_bold', 'label' => '列表标题粗体显示', 'type' => 'switch', 'default' => false],
['key' => 'post_list_author', 'label' => '显示文章作者', 'type' => 'switch', 'default' => true],
['key' => 'post_list_time', 'label' => '显示文章时间', 'type' => 'switch', 'default' => true],
['key' => 'list_meta_show', 'label' => '列表小部件(移动端优先)', 'type' => 'radio', 'default' => 'like', 'options' => [
['label' => '阅读量', 'value' => 'view'],
['label' => '点赞数', 'value' => 'like'],
['label' => '评论', 'value' => 'comm'],
]],
['key' => 'list_badge_show', 'label' => '显示列表标签', 'type' => 'checkbox', 'default' => ['pay', 'cat', 'tag'], 'options' => [
['label' => '付费信息', 'value' => 'pay'],
['label' => '分类', 'value' => 'cat'],
['label' => '标签', 'value' => 'tag'],
]],
],
],
[
'key' => 'layout',
'title' => '列表模式与 UI',
'fields' => [
['key' => 'list_show_type', 'label' => '列表样式', 'type' => 'radio', 'default' => 'separate', 'options' => [
['label' => '分离', 'value' => 'separate'],
['label' => '无间距', 'value' => 'no_margin'],
]],
['key' => 'list_type', 'label' => '默认列表模式', 'type' => 'radio', 'default' => 'thumb', 'options' => [
['label' => '列表文字模式', 'value' => 'text'],
['label' => '列表图文模式', 'value' => 'thumb'],
['label' => '列表自动图文模式', 'value' => 'thumb_if_has'],
['label' => '卡片模式', 'value' => 'card'],
], 'help' => '文字、自动图文和多图模式仅在开启侧栏的页面有效。'],
['key' => 'list_card_home', 'label' => '首页列表卡片模式', 'type' => 'switch', 'default' => false, 'dependsOn' => ['key' => 'list_type', 'not' => true, 'value' => 'card']],
['key' => 'list_card_tag', 'label' => '标签页列表卡片模式', 'type' => 'switch', 'default' => false, 'dependsOn' => ['key' => 'list_type', 'not' => true, 'value' => 'card']],
['key' => 'list_card_author', 'label' => '用户页列表卡片模式', 'type' => 'switch', 'default' => false, 'dependsOn' => ['key' => 'list_type', 'not' => true, 'value' => 'card']],
['key' => 'list_card_cat', 'label' => '分类页自定义卡片模式', 'type' => 'taxonomy_select', 'taxonomy' => 'category', 'multiple' => true, 'default' => [], 'dependsOn' => ['key' => 'list_type', 'not' => true, 'value' => 'card']],
[
'key' => 'list_list_option',
'label' => '列表模式 UI 配置',
'type' => 'fieldset',
'sanitize_type' => 'array',
'default' => ['style' => 'null', 'img_position' => 'left', 'scale' => 70],
'fields' => [
['key' => 'style', 'label' => '列表样式', 'type' => 'radio', 'default' => 'null', 'options' => [
['label' => '默认', 'value' => 'null'],
['label' => '样式 2', 'value' => 'style2'],
]],
['key' => 'img_position', 'label' => '缩略图位置', 'type' => 'radio', 'default' => 'left', 'options' => [
['label' => '靠左', 'value' => 'left'],
['label' => '靠右', 'value' => 'right'],
]],
['key' => 'scale', 'label' => '缩略图长宽比例(%)', 'type' => 'number', 'default' => 70, 'min' => 50, 'max' => 200, 'step' => 5],
],
],
[
'key' => 'list_card_option',
'label' => '卡片模式 UI 配置',
'type' => 'fieldset',
'sanitize_type' => 'array',
'default' => ['style' => 'null', 'scale' => 70],
'fields' => [
['key' => 'style', 'label' => '卡片样式', 'type' => 'radio', 'default' => 'null', 'options' => [
['label' => '默认', 'value' => 'null'],
['label' => '样式 3', 'value' => 'style3'],
]],
['key' => 'scale', 'label' => '缩略图长宽比例(%)', 'type' => 'number', 'default' => 70, 'min' => 20, 'max' => 200, 'step' => 5],
],
],
['key' => 'mult_thumb_cat', 'label' => '列表多图显示分类', 'type' => 'taxonomy_select', 'taxonomy' => 'category', 'multiple' => true, 'default' => [], 'help' => '文章格式为图片或画廊时默认显示 4 张缩略图;卡片模式或无侧栏时无效。'],
],
],
[
'key' => 'paging',
'title' => '列表翻页',
'fields' => [
['key' => 'paging_ajax_s', 'label' => '列表翻页模式', 'type' => 'radio', 'default' => '1', 'options' => [
['label' => 'AJAX 追加列表翻页', 'value' => '1'],
['label' => '数字翻页按钮', 'value' => '0'],
]],
['key' => 'paging_ajax_ias_s', 'label' => 'AJAX 自动加载', 'type' => 'switch', 'default' => true, 'dependsOn' => ['key' => 'paging_ajax_s', 'value' => '1']],
['key' => 'ias_max', 'label' => '自动加载页数', 'type' => 'number', 'default' => 3, 'min' => 0, 'max' => 10, 'dependsOn' => ['key' => 'paging_ajax_s', 'value' => '1']],
['key' => 'ajax_trigger', 'label' => '翻页按钮文字', 'type' => 'textarea', 'sanitize_type' => 'html', 'default' => '<i class="fa fa-angle-right"></i>加载更多'],
['key' => 'ajax_nomore', 'label' => '列表全部加载完毕文案', 'type' => 'textarea', 'sanitize_type' => 'html', 'default' => '没有更多内容了'],
],
],
],
];
}
}
+28 -52
View File
@@ -18,43 +18,28 @@ class SchemaPostList {
'thumb' => [
'key' => 'thumb',
'title' => '列表缩略图',
'version' => '1.0.0',
'version' => '9.0.0',
'option_key' => 'aksrt_settings',
'groups' => [
['key' => 'source', 'title' => '图片来源', 'fields' => [
['key' => 'thumb_priority', 'label' => '图片优先级', 'type' => 'input', 'default' => 'featured,attachment,resource,custom'],
['key' => 'thumb_fallback', 'label' => '无图时处理', 'type' => 'radio', 'default' => 'placeholder', 'options' => [
['label' => '显示占位图', 'value' => 'placeholder'],
['label' => '隐藏缩略图', 'value' => 'hide'],
['label' => '随机封面', 'value' => 'random'],
]],
['key' => 'thumb_spare_images', 'label' => '备用缩略图', 'type' => 'gallery', 'default' => [], 'dependsOn' => ['key' => 'thumb_fallback', 'value' => 'random'], 'description' => '当 thumb_fallback 为 random 时从此图库随机选取'],
['key' => 'thumb_aspect_ratio', 'label' => '图片比例', 'type' => 'select', 'default' => '16:9', 'options' => [
['label' => '16:9 宽屏', 'value' => '16:9'],
['label' => '4:3 标准', 'value' => '4:3'],
['label' => '1:1 正方形', 'value' => '1:1'],
['label' => '自适应', 'value' => 'auto'],
]],
['key' => 'list_thumb_fit', 'label' => '缩略图填充方式', 'type' => 'radio', 'default' => 'cover', 'options' => [
['label' => '填充裁剪', 'value' => 'cover'],
['label' => '完整显示', 'value' => 'contain'],
]],
['key' => 'source', 'title' => '图片来源', 'description' => '缩略图获取优先级:文章特色图像 > 外链特色图像 > 文章首图 > 分类封面图 > 备用缩略图 > 懒加载预载图。', 'fields' => [
['key' => 'list_thumb_slides_s', 'label' => '幻灯片缩略图', 'type' => 'switch', 'default' => true, 'description' => '允许幻灯片作为列表缩略图'],
['key' => 'list_thumb_video_s', 'label' => '视频缩略图', 'type' => 'switch', 'default' => true, 'description' => '鼠标悬停时自动播放视频缩略图'],
['key' => 'list_thumb_video_mute_s', 'label' => '视频缩略图静音', 'type' => 'switch', 'default' => true, 'dependsOn' => ['key' => 'list_thumb_video_s', 'value' => true], 'description' => '视频缩略图播放时静音'],
['key' => 'thumb_postfirstimg_s', 'label' => '自动获取文章首图', 'type' => 'switch', 'default' => true, 'description' => '自动从文章内容中提取第一张图片作为缩略图'],
['key' => 'thumb_catimg_s', 'label' => '自动获取分类封面', 'type' => 'switch', 'default' => true, 'description' => '无特色图时使用分类封面图作为缩略图'],
['key' => 'list_thumb_fit', 'label' => '缩略图填充方式', 'type' => 'radio', 'default' => '', 'options' => [
['label' => 'cover 铺满', 'value' => ''],
['label' => 'contain 等比例缩放', 'value' => 'contain'],
]],
['key' => 'thumb_postfirstimg_size', 'label' => '首图尺寸', 'type' => 'radio', 'default' => 'medium', 'dependsOn' => ['key' => 'thumb_postfirstimg_s', 'value' => true], 'options' => [
['label' => '缩略图', 'value' => 'thumbnail'],
['label' => '中等', 'value' => 'medium'],
['label' => '大', 'value' => 'large'],
['label' => '原始', 'value' => 'full'],
], 'description' => '自动获取文章首图时使用的 WP 图片尺寸'],
]],
['key' => 'multi', 'title' => '多图模式', 'fields' => [
['key' => 'thumb_multi_enabled', 'label' => '多图卡片', 'type' => 'switch', 'default' => false],
['key' => 'thumb_multi_count', 'label' => '最多显示几张', 'type' => 'number', 'default' => 3, 'min' => 2, 'max' => 6, 'dependsOn' => ['key' => 'thumb_multi_enabled', 'value' => true]],
['key' => 'mult_thumb_cat', 'label' => '按分类多图显示', 'type' => 'taxonomy_select', 'taxonomy' => 'category', 'multiple' => true, 'default' => [], 'dependsOn' => ['key' => 'thumb_multi_enabled', 'value' => true]],
['key' => 'spare_thumbnail', 'label' => '备用缩略图', 'type' => 'repeater', 'sanitize_type' => 'array', 'default' => [['img' => get_template_directory_uri() . '/assets/img/thumbnail.svg']], 'addText' => '添加备用缩略图', 'fields' => [
['key' => 'img', 'label' => '图片', 'type' => 'media', 'default' => ''],
]],
]],
],
],
@@ -102,34 +87,25 @@ class SchemaPostList {
['key' => 'post_lightbox_down', 'label' => '灯箱下载', 'type' => 'switch', 'default' => false],
['key' => 'post_lightbox_play', 'label' => '灯箱播放', 'type' => 'switch', 'default' => false],
]],
['key' => 'related', 'title' => '相关推荐', 'fields' => [
['key' => 'post_related_enabled', 'label' => '显示相关推荐', 'type' => 'switch', 'default' => true],
['key' => 'post_related_count', 'label' => '推荐数量', 'type' => 'number', 'default' => 6, 'min' => 1, 'max' => 20],
['key' => 'post_related_style', 'label' => '展示样式', 'type' => 'radio', 'default' => 'img', 'options' => [
['label' => '图文卡片', 'value' => 'img'],
['label' => '列表', 'value' => 'list'],
['label' => '纯文字', 'value' => 'text'],
], 'description' => '对齐 Zibll 相关文章三种样式'],
['key' => 'post_related_source', 'label' => '推荐来源', 'type' => 'radio', 'default' => 'category', 'options' => [
['label' => '同分类/标签', 'value' => 'category'],
['label' => '同标签', 'value' => 'tag'],
['label' => '随机', 'value' => 'random'],
]],
// Legacy alias kept so old saved values still round-trip.
['key' => 'post_related_type', 'label' => '推荐方式(兼容)', 'type' => 'radio', 'default' => 'category', 'options' => [
['label' => '同分类', 'value' => 'category'],
['label' => '同标签', 'value' => 'tag'],
['label' => '随机', 'value' => 'random'],
]],
['key' => 'post_related_orderby', 'label' => '推荐排序', 'type' => 'select', 'default' => 'views', 'options' => [
['label' => '浏览量', 'value' => 'views'],
['label' => '随机', 'value' => 'rand'],
['label' => '相关度', 'value' => 'relevance'],
['label' => '时间', 'value' => 'date'],
['label' => '更新时间', 'value' => 'modified'],
]],
['key' => 'post_related_title', 'label' => '推荐标题', 'type' => 'input', 'default' => '相关推荐'],
]],
['key' => 'related', 'title' => '相关推荐', 'fields' => [
['key' => 'post_related_s', 'label' => '显示相关推荐', 'type' => 'switch', 'default' => true],
['key' => 'post_related_type', 'label' => '展示样式', 'type' => 'radio', 'default' => 'img', 'options' => [
['label' => '图文卡片', 'value' => 'img'],
['label' => '列表', 'value' => 'list'],
['label' => '纯文字', 'value' => 'text'],
]],
['key' => 'related_title', 'label' => '推荐标题', 'type' => 'input', 'default' => '相关推荐'],
['key' => 'post_related_n', 'label' => '推荐数量', 'type' => 'number', 'default' => 6, 'min' => 4, 'max' => 12, 'step' => 2],
['key' => 'post_related_orderby', 'label' => '推荐排序', 'type' => 'select', 'default' => 'views', 'options' => [
['label' => '更新时间', 'value' => 'modified'],
['label' => '发布时间', 'value' => 'date'],
['label' => '浏览量', 'value' => 'views'],
['label' => '点赞量', 'value' => 'like'],
['label' => '评论量', 'value' => 'comment_count'],
['label' => '收藏数量', 'value' => 'favorite'],
['label' => '随机', 'value' => 'rand'],
]],
]],
['key' => 'interactions', 'title' => '互动功能', 'fields' => [
['key' => 'post_like_enabled', 'label' => '点赞', 'type' => 'switch', 'default' => true],
['key' => 'post_favorite_enabled', 'label' => '收藏', 'type' => 'switch', 'default' => true],