用户中心 posts/sidebar/form 渲染器整包拆分并清理标记
This commit is contained in:
1 parent
81d5647205
commit
57ccdb60c4
13 files changed
+450
-380
No files matched your search
@@ -10,56 +10,60 @@ defined('ABSPATH') || exit;
|
||||
$context = is_array($args['context'] ?? null) ? $args['context'] : [];
|
||||
extract($context, EXTR_SKIP); // phpcs:ignore WordPress.PHP.DontExtract.extract_extract
|
||||
?>
|
||||
<!-- ==================== 我的收藏 ==================== -->
|
||||
<div class="widget-card">
|
||||
<div class="profile-list-header">
|
||||
<h3 class="widget-title widget-title--inline">
|
||||
<?php printf( esc_html__( '我的收藏(%d 篇)', 'aksrt' ), $favorite_count ); ?>
|
||||
</h3>
|
||||
</div>
|
||||
<?php if ( ! empty( $favorite_post_ids ) ) :
|
||||
$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,
|
||||
] );
|
||||
if ( $favorites_query->have_posts() ) : ?>
|
||||
<div class="profile-list" data-list="favorites">
|
||||
<?php while ( $favorites_query->have_posts() ) : $favorites_query->the_post();
|
||||
get_template_part('templates/parts/content', 'profile-list-item', [
|
||||
'action' => [
|
||||
'type' => 'unfavorite',
|
||||
'url' => '#',
|
||||
'label' => __('取消收藏', 'aksrt'),
|
||||
],
|
||||
]);
|
||||
endwhile; ?>
|
||||
</div>
|
||||
<?php aksrt_render_profile_pagination( (int) $favorites_query->max_num_pages, $favorites_page, 'favorites_page' ); ?>
|
||||
<?php
|
||||
wp_reset_postdata();
|
||||
else :
|
||||
aksrt_render_profile_empty(
|
||||
$svg_empty_favorite,
|
||||
__( '收藏列表为空', 'aksrt' ),
|
||||
__( '点击文章页面的星标收藏喜欢的内容。', 'aksrt' ),
|
||||
home_url( '/' ),
|
||||
__( '去发现好文', 'aksrt' )
|
||||
);
|
||||
endif;
|
||||
else :
|
||||
aksrt_render_profile_empty(
|
||||
$svg_empty_favorite,
|
||||
__( '收藏列表为空', 'aksrt' ),
|
||||
__( '点击文章页面的星标收藏喜欢的内容。', 'aksrt' ),
|
||||
home_url( '/' ),
|
||||
__( '去发现好文', 'aksrt' )
|
||||
);
|
||||
endif; ?>
|
||||
</div>
|
||||
<div class="widget-card">
|
||||
<div class="profile-list-header">
|
||||
<h3 class="widget-title widget-title--inline">
|
||||
<?php printf(esc_html__('我的收藏(%d 篇)', 'aksrt'), $favorite_count); ?>
|
||||
</h3>
|
||||
</div>
|
||||
<?php if (!empty($favorite_post_ids)) :
|
||||
$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,
|
||||
]);
|
||||
if ($favorites_query->have_posts()) :
|
||||
?>
|
||||
<div class="profile-list" data-list="favorites">
|
||||
<?php
|
||||
while ($favorites_query->have_posts()) :
|
||||
$favorites_query->the_post();
|
||||
get_template_part('templates/parts/content', 'profile-list-item', [
|
||||
'action' => [
|
||||
'type' => 'unfavorite',
|
||||
'url' => '#',
|
||||
'label' => __('取消收藏', 'aksrt'),
|
||||
],
|
||||
]);
|
||||
endwhile;
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
aksrt_render_profile_pagination((int) $favorites_query->max_num_pages, $favorites_page, 'favorites_page');
|
||||
wp_reset_postdata();
|
||||
else :
|
||||
aksrt_render_profile_empty(
|
||||
$svg_empty_favorite,
|
||||
__('收藏列表为空', 'aksrt'),
|
||||
__('点击文章页面的星标收藏喜欢的内容。', 'aksrt'),
|
||||
home_url('/'),
|
||||
__('去发现好文', 'aksrt')
|
||||
);
|
||||
endif;
|
||||
else :
|
||||
aksrt_render_profile_empty(
|
||||
$svg_empty_favorite,
|
||||
__('收藏列表为空', 'aksrt'),
|
||||
__('点击文章页面的星标收藏喜欢的内容。', 'aksrt'),
|
||||
home_url('/'),
|
||||
__('去发现好文', 'aksrt')
|
||||
);
|
||||
endif;
|
||||
?>
|
||||
</div>
|
||||
Reference in new issue
Block a user