在我的博客存档页面上,如果我点击一个月,它会带我到一个页面,显示我当月创建的所有帖子(显然)。有没有过滤该页面的方法,以便它只显示我的某个类别的帖子?仅显示一个类别的月度存档(Wordpress)
archive.php
<?php if (have_posts()) : ?>
<div class="rightColumn">
<?php
while (have_posts()) : the_post();
get_template_part('content', get_post_format());
endwhile;
// Previous/next page navigation.
twentyfourteen_paging_nav();
else :
get_template_part('content', 'none');
endif;
?>
</div>
<?php
get_footer();
感谢。
这段代码的ONY问题它,做它的网站宽,当我去的网页我的其他类别没有职位出现。有没有一种方法只针对Archive.php页面? – Chris
您可以尝试在if语句中添加'&& basename($ _SERVER ['PHP_SELF'])=='archive.php'' – zoranc
我应该在哪里添加该代码? – Chris