WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm working on a site with 3 major sections. Therefore I want to create archives for each section and those archives should be visible only in the category page and it's posts.
At this point, I made the menu visible only for the category page, but when I open a post, the widget is not displayed.

How do I create archives for specific categories, and how do I display them in a specific category and its posts?

share|improve this question

In order to display any specific conditional content on a single post based on it's category, you have to edit the template called single.php. e.g. put something like this in single.php

if ( in_category( 'category1' )) {
    //code for category1
} elseif ( in_category( array( 'category2', 'category3' ) )) {
    // code for when t
} else {
    // code for others
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.