Files
wordpress-theme-aksrt/inc/helpers/user-center-renderers/profile-comments.php
T

48 lines
1.3 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
$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>