用户中心 posts/sidebar/form 渲染器整包拆分并清理标记
This commit is contained in:
1 parent
81d5647205
commit
57ccdb60c4
13 files changed
+450
-380
No files matched your search
@@ -10,37 +10,38 @@ 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' ), $comment_count ); ?>
|
||||
</h3>
|
||||
</div>
|
||||
<?php
|
||||
$comments_total = $comment_count;
|
||||
$cs = get_comments( [
|
||||
'user_id' => $user_id,
|
||||
'number' => $per_page,
|
||||
'offset' => ( $comments_page - 1 ) * $per_page,
|
||||
'status' => 'approve',
|
||||
'update_comment_meta_cache' => false,
|
||||
] );
|
||||
if ( $cs ) : ?>
|
||||
<div class="profile-comment-list">
|
||||
<?php foreach ( $cs as $c ) :
|
||||
get_template_part('templates/parts/content', 'profile-comment-item', ['comment' => $c]);
|
||||
endforeach; ?>
|
||||
</div>
|
||||
<?php
|
||||
$comments_total_pages = (int) ceil( $comments_total / $per_page );
|
||||
aksrt_render_profile_pagination( $comments_total_pages, $comments_page, 'comments_page' );
|
||||
?>
|
||||
<?php else :
|
||||
aksrt_render_profile_empty(
|
||||
$svg_empty_comment,
|
||||
__( '暂无评论', 'aksrt' ),
|
||||
__( '在你感兴趣的文章下留下你的看法吧。', 'aksrt' )
|
||||
);
|
||||
endif; ?>
|
||||
<div class="widget-card">
|
||||
<div class="profile-list-header">
|
||||
<h3 class="widget-title widget-title--inline">
|
||||
<?php printf(esc_html__('我的评论(%d 条)', 'aksrt'), $comment_count); ?>
|
||||
</h3>
|
||||
</div>
|
||||
<?php
|
||||
$cs = get_comments([
|
||||
'user_id' => $user_id,
|
||||
'number' => $per_page,
|
||||
'offset' => ($comments_page - 1) * $per_page,
|
||||
'status' => 'approve',
|
||||
'update_comment_meta_cache' => false,
|
||||
]);
|
||||
if ($cs) :
|
||||
?>
|
||||
<div class="profile-comment-list">
|
||||
<?php
|
||||
foreach ($cs as $c) {
|
||||
get_template_part('templates/parts/content', 'profile-comment-item', ['comment' => $c]);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
$comments_total_pages = (int) ceil($comment_count / $per_page);
|
||||
aksrt_render_profile_pagination($comments_total_pages, $comments_page, 'comments_page');
|
||||
else :
|
||||
aksrt_render_profile_empty(
|
||||
$svg_empty_comment,
|
||||
__('暂无评论', 'aksrt'),
|
||||
__('在你感兴趣的文章下留下你的看法吧。', 'aksrt')
|
||||
);
|
||||
endif;
|
||||
?>
|
||||
</div>
|
||||
Reference in new issue
Block a user