feat(post-list): align list schema with Zibll paging contract

Replace the post_list.list admin contract with a dedicated schema module
using Zibll keys (paging_ajax_s, paging_ajax_ias_s, ajax_trigger,
ajax_nomore, list_orderby, post_list_author/time, target_blank). Runtime
derives numbered/load_more/infinite from those keys and applies list
orderby on main queries without legacy dual-write layers.
This commit is contained in:
2026-07-11 13:49:48 +08:00
parent 63efe5b5a8
commit 6a9db98204
9 changed files with 652 additions and 280 deletions
@@ -14,104 +14,7 @@ class AKSRT_Admin_Schema_Post_List {
'domain' => 'post_list',
'title' => '文章&列表',
'sections' => [
'list' => [
'key' => 'list',
'title' => '文章列表',
'version' => '1.0.0',
'option_key' => 'aksrt_settings',
'groups' => [
['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' => 'meta', 'title' => '元信息显示', 'fields' => [
['key' => 'post_show_author', 'label' => '显示作者', 'type' => 'switch', 'default' => true],
['key' => 'post_show_date', 'label' => '显示日期', 'type' => 'switch', 'default' => true],
['key' => 'post_show_views', 'label' => '显示浏览数', 'type' => 'switch', 'default' => true],
['key' => 'post_show_category', 'label' => '显示分类', 'type' => 'switch', 'default' => true],
['key' => 'post_show_tags', 'label' => '显示标签', 'type' => 'switch', 'default' => false],
['key' => 'post_show_comments', 'label' => '显示评论数', 'type' => 'switch', 'default' => false],
['key' => 'post_show_likes', 'label' => '显示点赞数', 'type' => 'switch', 'default' => false],
['key' => 'list_badge_show', 'label' => '显示徽章类型', 'type' => 'checkbox', 'default' => ['pay', 'tag', 'topics', 'cat'], 'options' => [
['label' => '付费', 'value' => 'pay'],
['label' => '分类', 'value' => 'cat'],
['label' => '专题', 'value' => 'topics'],
['label' => '标签', 'value' => 'tag'],
]],
['key' => 'post_list_meta_show', 'label' => '显示元信息', 'type' => 'switch', 'default' => true],
['key' => 'list_meta_show', 'label' => '移动端优先部件', 'type' => 'radio', 'default' => 'like', 'options' => [
['label' => '浏览数', 'value' => 'view'],
['label' => '点赞数', 'value' => 'like'],
['label' => '评论数', 'value' => 'comm'],
], 'description' => '移动端空间不足时保留显示的单一部件'],
]],
['key' => 'layout', 'title' => '布局设置', 'fields' => [
['key' => 'post_list_columns', 'label' => '列表列数', 'type' => 'number', 'default' => 1, 'min' => 1, 'max' => 3],
['key' => 'post_list_per_page', 'label' => '每页文章数', 'type' => 'number', 'default' => 12, 'min' => 4, 'max' => 48],
['key' => 'sticky_s', 'label' => '置顶范围', 'type' => 'checkbox', 'default' => ['home', 'cat'], 'options' => [
['label' => '首页', 'value' => 'home'],
['label' => '分类页', 'value' => 'cat'],
['label' => '标签页', 'value' => 'tag'],
['label' => '专题页', 'value' => 'topics'],
]],
['key' => 'post_target_blank', 'label' => '新窗口打开', 'type' => 'switch', 'default' => false],
['key' => 'item_heading_bold', 'label' => '标题加粗', 'type' => 'switch', 'default' => false],
['key' => 'list_show_type', 'label' => '列表样式', 'type' => 'radio', 'default' => 'separate', 'options' => [
['label' => '分隔卡片', 'value' => 'separate'],
['label' => '无间距', 'value' => 'no_margin'],
]],
['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_topics', 'label' => '专题页卡片模式', 'type' => 'switch', 'default' => false],
['key' => 'list_card_author', 'label' => '用户页卡片模式', 'type' => 'switch', 'default' => false],
]],
['key' => 'pagination', 'title' => '分页方式', 'fields' => [
['key' => 'post_pagination_mode', 'label' => '分页模式', 'type' => 'radio', 'default' => 'numbered', 'options' => [
['label' => '数字分页', 'value' => 'numbered'],
['label' => '加载更多', 'value' => 'load_more'],
['label' => '无限滚动', 'value' => 'infinite'],
]],
['key' => 'ias_max', 'label' => '最大加载页数', 'type' => 'number', 'default' => 3, 'min' => 0, 'max' => 10, 'description' => '0=不限'],
['key' => 'ajax_trigger_text', 'label' => '加载更多文案', 'type' => 'input', 'default' => ''],
['key' => 'ajax_nomore_text', 'label' => '没有更多文案', 'type' => 'input', 'default' => ''],
]],
['key' => 'sort', 'title' => '默认排序', 'fields' => [
['key' => 'list_orderby', 'label' => '列表默认排序', 'type' => 'radio', 'default' => 'modified', 'options' => [
['label' => '更新时间', 'value' => 'modified'],
['label' => '发布时间', 'value' => 'date'],
['label' => '评论数', 'value' => 'comments'],
['label' => 'WordPress 默认', 'value' => 'default'],
], 'help' => '分类/标签/归档页面的默认排序方式'],
]],
['key' => 'list_option', 'title' => '列表模式配置', 'fields' => [
['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' => 'card_option', 'title' => '卡片模式配置', 'fields' => [
['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],
]],
],
],
'list' => AKSRT_Admin_Schema_Post_List_List::build(),
'thumb' => [
'key' => 'thumb',
'title' => '列表缩略图',