fix(list): wire Zibll list/card display chain end-to-end
Resolve post list mode from global list_type + surface card overrides so homepage/archives/AJAX honor admin list and card style settings.
This commit is contained in:
1 parent
b2815614d1
commit
d73a7af25e
17 files changed
+444
-151
No files matched your search
@@ -301,13 +301,20 @@ class AKSRT_Admin_Global_Controller extends AKSRT_Admin_Controller_Base {
|
||||
|
||||
$query = new WP_Query($args);
|
||||
|
||||
$mode = in_array($view_mode, ['card', 'list'], true) ? $view_mode : 'list';
|
||||
$mode = in_array($view_mode, ['card', 'list'], true) ? $view_mode : '';
|
||||
$html = '';
|
||||
if (function_exists('aksrt_render_post_list')) {
|
||||
$html = aksrt_render_post_list($query, [
|
||||
'mode' => $mode,
|
||||
'context' => 'home',
|
||||
], false);
|
||||
$overrides = ['context' => 'home'];
|
||||
if ($mode !== '') {
|
||||
$overrides['mode'] = $mode;
|
||||
}
|
||||
$render_config = function_exists('aksrt_resolve_post_list_render_config')
|
||||
? aksrt_resolve_post_list_render_config([
|
||||
'context' => 'home',
|
||||
'overrides' => $overrides,
|
||||
])
|
||||
: array_merge(['mode' => ($mode !== '' ? $mode : 'list'), 'context' => 'home'], $overrides);
|
||||
$html = aksrt_render_post_list($query, $render_config, false);
|
||||
} elseif ($query->have_posts()) {
|
||||
$html = '<div class="posts-row aksrt-homepage__posts" data-view="' . esc_attr($mode) . '">';
|
||||
while ($query->have_posts()) {
|
||||
|
||||
@@ -159,16 +159,16 @@ class AKSRT_Admin_Schema_Post_List_List {
|
||||
'fields' => [
|
||||
[
|
||||
'key' => 'post_card_style',
|
||||
'label' => '列表卡片样式',
|
||||
'label' => '默认列表模式',
|
||||
'type' => 'select',
|
||||
'default' => 'thumb',
|
||||
'options' => [
|
||||
['label' => '标准图文', 'value' => 'thumb'],
|
||||
['label' => '列表图文模式', 'value' => 'thumb'],
|
||||
['label' => '紧凑卡', 'value' => 'compact'],
|
||||
['label' => '大图卡', 'value' => 'large_thumb'],
|
||||
['label' => '多图卡', 'value' => 'multi_thumb'],
|
||||
['label' => '纯文字', 'value' => 'text'],
|
||||
['label' => '有图则图文', 'value' => 'thumb_if_has'],
|
||||
['label' => '列表文字模式', 'value' => 'text'],
|
||||
['label' => '列表自动图文', 'value' => 'thumb_if_has'],
|
||||
['label' => '卡片模式', 'value' => 'card'],
|
||||
],
|
||||
],
|
||||
|
||||
Reference in new issue
Block a user