- This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- The forum ‘Back End’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
I’m working on a blog that uses categories for the navigation. its for a school and each part of the school has its own category, every post gets assigned the right cat and then only shows up in its section etc.
Each category has an image in the sidebar that changes as you navigate through.
problem is, when you go to the "Middle School" it shows the correct image in the sidebar, then when you click on a post, it shows the default image. my php isnt pulling the category despite it being in the url still. any ideas on how i can do this?
Get the parent category of a post and display the correct image?
here’s the code:
any ideas guys?
Moved to CMS section, might get more looks here.
is_category() is only true if the current page is the category’s archive page, so it won’t help you if you want to style a single post page.
To determine if the current post has a certain category assigned you can use in_category(). E.g.
A simpler solution might involve putting what you want to appear in the side bar in the category’s description and simply using the following in your single.php:
Hope that helps!