47 lines
1.5 KiB
PHP
47 lines
1.5 KiB
PHP
<?php
|
|
/**
|
|
* User center profile comments part.
|
|
*
|
|
* @package AKSRT
|
|
*/
|
|
|
|
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>
|