feat(frontend): replace article system with Zibll 9.0
This commit is contained in:
1 parent
2881c69e9c
commit
0f2ac6c34a
69 files changed
+2603
-4163
No files matched your search
@@ -52,11 +52,7 @@ if (function_exists('aksrt_archive_open_shell')) {
|
||||
<?php endwhile; ?>
|
||||
</div>
|
||||
<?php
|
||||
if (function_exists('aksrt_render_pagination')) {
|
||||
aksrt_render_pagination($query);
|
||||
} else {
|
||||
echo '<div class="aksrt-pagination">' . paginate_links(['total' => $query->max_num_pages]) . '</div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
aksrt_render_pagination($query);
|
||||
wp_reset_postdata();
|
||||
?>
|
||||
<?php else : ?>
|
||||
|
||||
@@ -8,24 +8,4 @@
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
$args = isset($args) && is_array($args) ? $args : [];
|
||||
$forced_layout = (string) get_query_var('aksrt_post_card_layout', '');
|
||||
$mode = 'card';
|
||||
|
||||
if (in_array($forced_layout, ['card', 'list', 'grid-cms'], true)) {
|
||||
$mode = $forced_layout;
|
||||
} elseif (!empty($args['mode']) && in_array($args['mode'], ['card', 'list', 'grid-cms', 'mini'], true)) {
|
||||
$mode = (string) $args['mode'];
|
||||
} elseif (function_exists('aksrt_get_post_flow') && aksrt_get_post_flow(get_the_ID()) === 'cms') {
|
||||
$mode = 'grid-cms';
|
||||
} elseif (class_exists('\AKSRT\Settings\Settings')) {
|
||||
$archive_layout = \AKSRT\Settings\Settings::get_archive_layout();
|
||||
$mode = in_array($archive_layout, ['card', 'list', 'grid-cms'], true) ? $archive_layout : 'card';
|
||||
}
|
||||
|
||||
$scene = (string) get_query_var('aksrt_post_card_scene', '');
|
||||
$context = ($scene === 'home' || is_front_page() || (is_home() && !is_paged())) ? 'home' : 'archive';
|
||||
|
||||
echo aksrt_render_post(array_merge($args, [
|
||||
'mode' => $mode,
|
||||
'context' => $context,
|
||||
])); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
echo aksrt_render_post($args); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
@@ -15,7 +15,7 @@ $layout = (string) ($cfg['layout'] ?? 'card');
|
||||
$columns = max(1, min(6, (int) ($cfg['columns'] ?? 4)));
|
||||
$title = (string) ($cfg['title'] ?? '');
|
||||
|
||||
if (!in_array($layout, ['card', 'list', 'masonry', 'grid-cms'], true)) {
|
||||
if (!in_array($layout, ['card', 'list'], true)) {
|
||||
$layout = 'card';
|
||||
}
|
||||
|
||||
@@ -53,15 +53,13 @@ $more_link = $cat_id > 0 ? get_category_link($cat_id) : '';
|
||||
<?php endif; ?>
|
||||
</header>
|
||||
|
||||
<div class="post-grid post-grid--<?php echo esc_attr($layout); ?>" style="--cols:<?php echo (int) $columns; ?>;">
|
||||
<div class="posts-row ajaxpager">
|
||||
<?php
|
||||
set_query_var('aksrt_post_card_layout', $layout);
|
||||
while ($query->have_posts()) {
|
||||
$query->the_post();
|
||||
get_template_part('templates/parts/content', 'post-card');
|
||||
}
|
||||
set_query_var('aksrt_post_card_layout', '');
|
||||
wp_reset_postdata();
|
||||
aksrt_render_post_list([
|
||||
'type' => $layout === 'card' ? 'card' : 'list',
|
||||
'is_home' => true,
|
||||
'skip_wrapper' => true,
|
||||
], $query);
|
||||
?>
|
||||
</div>
|
||||
</section>
|
||||
@@ -16,7 +16,7 @@ $count = max(1, min(20, (int) ($cfg['count'] ?? 6)));
|
||||
$layout = (string) ($cfg['layout'] ?? 'card');
|
||||
$title = (string) ($cfg['title'] ?? '');
|
||||
|
||||
if (!in_array($layout, ['card', 'list', 'masonry', 'grid-cms'], true)) {
|
||||
if (!in_array($layout, ['card', 'list'], true)) {
|
||||
$layout = 'card';
|
||||
}
|
||||
|
||||
@@ -49,16 +49,13 @@ $archive_link = get_permalink(get_option('page_for_posts'));
|
||||
<?php endif; ?>
|
||||
</header>
|
||||
|
||||
<div class="post-grid post-grid--<?php echo esc_attr($layout); ?>">
|
||||
<div class="posts-row ajaxpager">
|
||||
<?php
|
||||
set_query_var('aksrt_post_card_layout', $layout);
|
||||
set_query_var('aksrt_post_card_scene', 'home');
|
||||
while ($query->have_posts()) {
|
||||
$query->the_post();
|
||||
get_template_part('templates/parts/content', 'post-card');
|
||||
}
|
||||
set_query_var('aksrt_post_card_layout', '');
|
||||
set_query_var('aksrt_post_card_scene', '');
|
||||
aksrt_render_post_list([
|
||||
'type' => $layout === 'card' ? 'card' : 'list',
|
||||
'is_home' => true,
|
||||
'skip_wrapper' => true,
|
||||
], $query);
|
||||
?>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -16,11 +16,11 @@ if (!is_array($cfg)) $cfg = [];
|
||||
$cat_ids = isset($cfg['cat_ids']) && is_array($cfg['cat_ids']) ? array_map('intval', $cfg['cat_ids']) : [];
|
||||
$cat_ids = array_filter($cat_ids, fn($x) => $x > 0);
|
||||
$count = max(1, min(20, (int) ($cfg['count'] ?? 8)));
|
||||
$layout = (string) ($cfg['layout'] ?? 'grid-cms');
|
||||
$layout = (string) ($cfg['layout'] ?? 'card');
|
||||
$title = (string) ($cfg['title'] ?? '');
|
||||
|
||||
if (!in_array($layout, ['card', 'list', 'masonry', 'grid-cms'], true)) {
|
||||
$layout = 'grid-cms';
|
||||
if (!in_array($layout, ['card', 'list'], true)) {
|
||||
$layout = 'card';
|
||||
}
|
||||
|
||||
if (empty($cat_ids)) {
|
||||
@@ -86,15 +86,11 @@ $active_id = $tabs[0]['id'];
|
||||
<?php if ($query->have_posts()) : ?>
|
||||
<div class="posts-row ajaxpager tab-content">
|
||||
<?php
|
||||
set_query_var('aksrt_post_card_layout', $layout === 'list' ? 'list' : 'card');
|
||||
set_query_var('aksrt_post_card_scene', 'home');
|
||||
while ($query->have_posts()) {
|
||||
$query->the_post();
|
||||
get_template_part('templates/parts/content', 'post-card');
|
||||
}
|
||||
set_query_var('aksrt_post_card_layout', '');
|
||||
set_query_var('aksrt_post_card_scene', '');
|
||||
wp_reset_postdata();
|
||||
aksrt_render_post_list([
|
||||
'type' => $layout === 'card' ? 'card' : 'list',
|
||||
'is_home' => true,
|
||||
'skip_wrapper' => true,
|
||||
], $query);
|
||||
?>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
|
||||
@@ -43,15 +43,22 @@ if (!$query->have_posts()) {
|
||||
<header class="resource-related__header">
|
||||
<h2 class="resource-related__title"><?php esc_html_e('相关资源', 'aksrt'); ?></h2>
|
||||
</header>
|
||||
<div class="resource-related__grid post-grid post-grid--card">
|
||||
<?php
|
||||
set_query_var('aksrt_post_card_layout', 'card');
|
||||
while ($query->have_posts()) {
|
||||
$query->the_post();
|
||||
get_template_part('templates/parts/content', 'post-card');
|
||||
}
|
||||
set_query_var('aksrt_post_card_layout', '');
|
||||
wp_reset_postdata();
|
||||
?>
|
||||
<div class="resource-related__grid zib-widget">
|
||||
<div class="swiper-container swiper-scroll">
|
||||
<div class="swiper-wrapper">
|
||||
<?php
|
||||
while ($query->have_posts()) {
|
||||
$query->the_post();
|
||||
$post = get_post();
|
||||
if ($post instanceof WP_Post) {
|
||||
echo aksrt_render_related_graphic_card($post); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
}
|
||||
wp_reset_postdata();
|
||||
?>
|
||||
</div>
|
||||
<div class="swiper-button-prev"></div>
|
||||
<div class="swiper-button-next"></div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -20,29 +20,18 @@ extract($args, EXTR_SKIP); // phpcs:ignore WordPress.PHP.DontExtract.extract_ext
|
||||
'post_status' => 'publish',
|
||||
'paged' => $posts_page,
|
||||
'no_found_rows' => false,
|
||||
'update_post_meta_cache' => false,
|
||||
]);
|
||||
if ($author_posts->have_posts()) :
|
||||
?>
|
||||
<div class="profile-list">
|
||||
<?php while ($author_posts->have_posts()) : $author_posts->the_post(); ?>
|
||||
<?php
|
||||
get_template_part('templates/parts/content', 'profile-list-item', [
|
||||
'action' => [
|
||||
'type' => 'view',
|
||||
'url' => get_permalink(),
|
||||
'label' => __('阅读', 'aksrt'),
|
||||
],
|
||||
]);
|
||||
?>
|
||||
<?php endwhile; ?>
|
||||
</div>
|
||||
<?php
|
||||
aksrt_render_profile_pagination((int) $author_posts->max_num_pages, $posts_page, 'posts_page');
|
||||
wp_reset_postdata();
|
||||
else :
|
||||
aksrt_render_profile_empty($svg_empty_post, __('TA 还没有发布文章', 'aksrt'));
|
||||
endif;
|
||||
$author_render_config = aksrt_resolve_post_list_render_config([
|
||||
'context' => 'author',
|
||||
]);
|
||||
aksrt_render_post_list(array_merge($author_render_config, ['wrapper_class' => 'profile-list']), $author_posts);
|
||||
aksrt_render_pagination($author_posts, [
|
||||
'query_context' => 'author',
|
||||
'render_config' => $author_render_config,
|
||||
'page_var' => 'posts_page',
|
||||
'current_page' => $posts_page,
|
||||
]);
|
||||
wp_reset_postdata();
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
Reference in new issue
Block a user