Files
wordpress-theme-aksrt/templates/parts/user-home/panel-posts.php
T
kate522andClaude Fable 5 45dc909e4c fix(user-home): span the tab pagination skeleton across the post grid
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>
2026-10-04 13:17:02 +08:00

41 lines
1.6 KiB
PHP

<?php
/**
* Public user home — posts tab panel body.
*
* Rendered inside the #panel-posts 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
$user_home_render_config = aksrt_resolve_post_list_render_config([
'context' => 'author',
'overrides' => [
'no_author' => true,
'no_margin' => true,
],
]);
$author_posts = new WP_Query([
'author' => $user_id,
'posts_per_page' => $per_page,
'post_status' => 'publish',
'paged' => $posts_page,
'no_found_rows' => 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]), $author_posts);
aksrt_render_user_home_pagination((int) $author_posts->max_num_pages, (int) $posts_page);
wp_reset_postdata();