导入 AKSRT 主题开发源码
This commit is contained in:
1 parent
9681dd3d48
commit
1268a55dd0
595 files changed
+127705
No files matched your search
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Profile Comment List Item — image-less comment row for user center.
|
||||
*
|
||||
* 通过 set_query_var() 接收:
|
||||
* - aksrt_profile_comment: WP_Comment 对象
|
||||
*
|
||||
* @package AKSRT
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
$comment = get_query_var('aksrt_profile_comment');
|
||||
if (!$comment instanceof WP_Comment) {
|
||||
return;
|
||||
}
|
||||
|
||||
$post = get_post((int) $comment->comment_post_ID);
|
||||
if (!$post) {
|
||||
return;
|
||||
}
|
||||
|
||||
$snippet = wp_trim_words(wp_strip_all_tags($comment->comment_content), 30, '…');
|
||||
$post_title = get_the_title($post);
|
||||
$comment_link = get_comment_link($comment);
|
||||
$post_link = get_permalink($post);
|
||||
$date_iso = get_comment_date('c', $comment);
|
||||
$date_label = get_comment_date('Y-m-d', $comment);
|
||||
$time_diff = human_time_diff(strtotime($comment->comment_date), current_time('timestamp'));
|
||||
?>
|
||||
<article class="profile-comment-item">
|
||||
<a href="<?php echo esc_url($comment_link); ?>" class="profile-comment-item__quote-link" aria-label="<?php esc_attr_e('查看评论', 'aksrt'); ?>">
|
||||
<span class="profile-comment-item__quote-mark" aria-hidden="true">“</span>
|
||||
<span class="profile-comment-item__quote-text"><?php echo esc_html($snippet); ?></span>
|
||||
</a>
|
||||
<div class="profile-comment-item__meta">
|
||||
<span class="profile-comment-item__meta-item profile-comment-item__meta-item--post">
|
||||
<i class="far fa-file-alt" aria-hidden="true"></i>
|
||||
<?php esc_html_e('在', 'aksrt'); ?>
|
||||
<a href="<?php echo esc_url($post_link); ?>" class="profile-comment-item__post-link"><?php echo esc_html($post_title); ?></a>
|
||||
</span>
|
||||
<span class="profile-comment-item__meta-sep" aria-hidden="true">·</span>
|
||||
<time class="profile-comment-item__meta-item" datetime="<?php echo esc_attr($date_iso); ?>" title="<?php echo esc_attr($date_label); ?>">
|
||||
<?php
|
||||
/* translators: %s: human time diff */
|
||||
printf(esc_html__('%s前', 'aksrt'), esc_html($time_diff));
|
||||
?>
|
||||
</time>
|
||||
</div>
|
||||
</article>
|
||||
Reference in new issue
Block a user