Support » Themes and Templates » Maintaining category templates when viewing single post.

  • 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?

  • The topic ‘Maintaining category templates when viewing single post.’ is closed to new replies.