【发布时间】:2018-06-29 09:13:11
【问题描述】:
您好,我有以下自定义 wordpress 查询。这可以很好地显示所有博客文章。
<?php $mymain_query = new WP_Query( array( 'post_type' => 'post','posts_per_page' => '10' ) ); while($mymain_query->have_posts()) : $mymain_query->the_post(); ?>
//shortened code below
<div class="blog-post">
<h5><?php the_title(); ?></h5>
<p><?php the_content(): ?></p>
</div>
<?php endwhile; ?>
<?php wp_reset_postdata(); // reset the query ?>
但是当我将其插入archive.php 时,它仍然调用所有博客文章,而不是该类别中的文章。
谁能建议如何编辑我的代码以仅显示该特定类别的博客文章?
谢谢!
【问题讨论】: