Files
wordpress-theme-aksrt/templates/parts/user-home/panel-posts.php
T
2026-08-23 18:01:56 +08:00

35 lines
1.0 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,
]);
aksrt_render_post_list(array_merge($user_home_render_config, ['wrapper_class' => 'aksrt-user-home__post-list']), $author_posts);
aksrt_render_user_home_pagination((int) $author_posts->max_num_pages, (int) $posts_page);
wp_reset_postdata();