在我的博客存檔頁面上,如果我點擊一個月,它會帶我到一個頁面,顯示我當月創建的所有帖子(顯然)。有沒有過濾該頁面的方法,以便它只顯示我的某個類別的帖子?僅顯示一個類別的月度存檔(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