Forums

[resolved] Conditionals - Single Post in Specific category (4 posts)

  1. lalindsey
    Member
    Posted 4 years ago #

    I want to change sub links to my main navigation depending on what category a user if viewing a single entry from. So, say I have an entry in a category called "reviews". I want all the single posts in the reviews category to show the different subnav for those pages.

    I've tried to use the is_category/is_single conditionals, but the is_category just shows the nav on the category archive page.

    I know I could create a new template for those categories I want to have different navigations, but I was wondering if it's possible using the conditionals to tell it if this post is in this category than this is the subnav that should display.

    I hope I didn't over-explain that.

    Lindsey

  2. Jeremy Clark
    Moderator
    Posted 4 years ago #

    Have a look at the docs on the template tag next_post_link / previous_post_link

  3. moshu
    Member
    Posted 4 years ago #

    I was wondering if it's possible using the conditionals to tell it if this post is in this category

    Yes, it is on the same Conditionals page where you have found the rest... it is called in_category (as opposed to is_category)

  4. lalindsey
    Member
    Posted 4 years ago #

    Thank you moshu, I must have just overlooked that. Thanks!!!

Topic Closed

This topic has been closed to new replies.

About this Topic