I am using the twenty eleven theme in my wordpress site.
In posts, I have two categories. One is blogs and other is News.
The monthly archive displays the posts of all categories while I want that the monthly archive should only display the posts of blogs category.
How will I do this?
I have also installed the wp_pagenavi plugin for the pagination.
There are two ways of doing it:
You can use a filter to alter the query when viewing an archive page. You will need to find the ID of your category ‘blogs’ (you can obtain it from the slug using
get_term_by
). Alternatively you can exclude a particular category by ID.or, more commonly, you can alter the
archive.php
template file and insert the following just above theif(have_posts())
.See the Codex on
query_posts
andWP_Query
.