导入 AKSRT 主题开发源码
This commit is contained in:
1 parent
9681dd3d48
commit
1268a55dd0
595 files changed
+127705
No files matched your search
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* 用户中心 — 我的文章
|
||||
*
|
||||
* @package AKSRT
|
||||
* @since 5.0.0
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
$user_id = get_current_user_id();
|
||||
$per_page = 10;
|
||||
$paged = max(1, get_query_var('paged'));
|
||||
|
||||
$query = new WP_Query([
|
||||
'author' => $user_id,
|
||||
'post_type' => 'post',
|
||||
'post_status' => 'publish',
|
||||
'posts_per_page' => $per_page,
|
||||
'paged' => $paged,
|
||||
'no_found_rows' => false,
|
||||
]);
|
||||
?>
|
||||
|
||||
<div class="uc-posts" id="uc-posts">
|
||||
<?php if ($query->have_posts()) : ?>
|
||||
<div class="uc-posts__list">
|
||||
<?php while ($query->have_posts()) : $query->the_post(); ?>
|
||||
<div class="uc-posts__item">
|
||||
<div class="uc-posts__content">
|
||||
<h4 class="uc-posts__title">
|
||||
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
|
||||
</h4>
|
||||
<div class="uc-posts__meta">
|
||||
<span><i class="far fa-clock"></i> <?php echo esc_html(get_the_date()); ?></span>
|
||||
<span><i class="far fa-eye"></i> <?php echo esc_html(get_post_meta(get_the_ID(), 'aksrt_post_views', true) ?: 0); ?></span>
|
||||
<span><i class="far fa-comment"></i> <?php echo esc_html(get_comments_number()); ?></span>
|
||||
</div>
|
||||
</div>
|
||||
<?php if (has_post_thumbnail()) : ?>
|
||||
<a href="<?php the_permalink(); ?>" class="uc-posts__thumb">
|
||||
<?php the_post_thumbnail('thumbnail'); ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endwhile; ?>
|
||||
</div>
|
||||
|
||||
<?php if ($query->max_num_pages > 1) : ?>
|
||||
<div class="aksrt-pagination">
|
||||
<?php
|
||||
echo paginate_links([
|
||||
'base' => str_replace(999999999, '%#%', esc_url(get_pagenum_link(999999999))),
|
||||
'format' => '?paged=%#%',
|
||||
'current' => $paged,
|
||||
'total' => $query->max_num_pages,
|
||||
'prev_text' => '<i class="fas fa-chevron-left"></i>',
|
||||
'next_text' => '<i class="fas fa-chevron-right"></i>',
|
||||
]);
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php else : ?>
|
||||
<div class="empty-state empty-state--sm">
|
||||
<div class="empty-state__icon"><i class="far fa-file-alt"></i></div>
|
||||
<p class="empty-state__title"><?php esc_html_e('暂无文章', 'aksrt'); ?></p>
|
||||
<p class="empty-state__desc"><?php esc_html_e('你还没有发布过文章,去写一篇吧~', 'aksrt'); ?></p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php wp_reset_postdata(); ?>
|
||||
</div>
|
||||
Reference in new issue
Block a user