0

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?

1 Answer 1

0

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
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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