WordPress.org

Ready to get started?Download WordPress

Forums

Maintaining category templates when viewing single post. (1 post)

  1. Gentist
    Member
    Posted 7 years ago #

    I've made some psuedo-templates for some categories, adding an extra menu. However, I'd like it to work when viewing single posts belonging to a specific category instead of the entire category. Using in_category() would be ideal, but it only works within The Loop, and adding the template code within The Loop would (I suspect) add the extra menu between each post, when I only want it to appear at the top, once.

    Now, I know I can use in_category() outside of the loop by manually setting the $post variable. However, it doesn't work properly, since I'm already using that variable in the relevant part of the code.

    Is there a to limit it to only work when viewing single posts, so that I can safely use it in The Loop?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.