The posts/favorites tabs turn the article list into a 2-column grid at >=992px. The AJAX pagination skeleton .post_ajax_loader is a direct child of that grid, so with no grid-column it was laid out as a single half-width card and the whole placeholder stack collapsed into one column while paging or switching tabs. Span the loader across every column and, while loading, give it the same 2-column template the real cards use so placeholders line up with them. The skeleton shape now follows the resolved render mode instead of a hardcoded 'list', so card mode no longer renders list blocks. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
49 lines
2.0 KiB
PHP
49 lines
2.0 KiB
PHP
<?php
|
|
/**
|
|
* Public user home — favorites tab panel body.
|
|
*
|
|
* Rendered inside the #panel-favorites wrapper on the public user home and via
|
|
* the aksrt/v1 user-home panel REST fragment. Pagination is button-driven
|
|
* (aksrt_render_user_home_pagination) and never touches the URL.
|
|
*
|
|
* @package AKSRT
|
|
*/
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
$args = is_array($args ?? null) ? $args : [];
|
|
extract($args, EXTR_SKIP); // phpcs:ignore WordPress.PHP.DontExtract.extract_extract
|
|
|
|
if (!empty($favorite_post_ids)) :
|
|
$user_home_render_config = aksrt_resolve_post_list_render_config([
|
|
'context' => 'author',
|
|
'overrides' => [
|
|
'no_author' => true,
|
|
'no_margin' => true,
|
|
],
|
|
]);
|
|
|
|
$favorites_query = new WP_Query([
|
|
'post_type' => 'post',
|
|
'post_status' => 'publish',
|
|
'post__in' => $favorite_post_ids,
|
|
'orderby' => 'post__in',
|
|
'posts_per_page' => $per_page,
|
|
'paged' => $favorites_page,
|
|
'ignore_sticky_posts' => true,
|
|
'no_found_rows' => false,
|
|
'update_post_meta_cache' => false,
|
|
]);
|
|
// 面板 AJAX 翻页期间由 author.js 切 .is-loading,骨架沿用文章列表的
|
|
// .post_ajax_loader 契约。形状跟随同一份渲染配置(list / card):
|
|
// 卡片模式下若仍渲染列表块,骨架就与真实卡片不同轴。
|
|
$user_home_panel_loader = function_exists('aksrt_render_placeholder')
|
|
? '<div class="post_ajax_loader" role="status" aria-label="' . esc_attr__('正在加载', 'aksrt') . '">' . aksrt_render_placeholder((string) ($user_home_render_config['mode'] ?? 'list'), max(4, (int) $per_page)) . '</div>'
|
|
: '';
|
|
aksrt_render_post_list(array_merge($user_home_render_config, ['wrapper_class' => 'aksrt-user-home__post-list', 'append_inner_html' => $user_home_panel_loader]), $favorites_query);
|
|
aksrt_render_user_home_pagination((int) $favorites_query->max_num_pages, (int) $favorites_page);
|
|
wp_reset_postdata();
|
|
else :
|
|
aksrt_render_profile_empty($svg_empty_favorite, __('TA 还没有收藏文章', 'aksrt'));
|
|
endif;
|