我刚开始玩 WordPress,并创建了一个有趣的主题。
一切正常,除了当我点击档案月份或类别时,我被带到的页面就像主页一样显示所有博客文章,即使 slug 是正确的。
我创建了一个存档页面和类别页面,复制了主页,因为我希望设计相同。
<div class="recentBlogsWrapper">
<h3><?php single_cat_title(); ?><?php get_the_archive_title(); ?> Category</h3>
<div class="blogPostWrapper">
<?php
$args = array(
'post_type' => 'post',
'posts_per_page' => 4,
);
$blogposts = new WP_Query($args);
while($blogposts->have_posts()) {
$blogposts->the_post();
?>
<a href="<?php echo the_permalink(); ?>" class="blogCard card">
<div class="blogHomeImgWrap">
<img class="blogPostImg" src="<?php echo get_the_post_thumbnail_url('get_the_ID'(),'full') ?>" />
</div>
<div class="blogPadding">
<h3><?php the_title(); ?></h3>
<p><?php the_time('F j, Y') ?></p>
</div>
</a>
<?php } wp_reset_query(); ?>
</div>
</div>
我在查询中缺少什么以及如何引用我刚刚单击的链接?
慕森卡