Single Post Under Multiple Categories?
-
Right now, I have my blog set up so when your on the photos category page it displays the div “photos” and when there is a single post in the photo category it displays the div “photos” also , the same thing goes for “videos”. This works awesome but the problem is, when a post is displayed under both the photos and videos category, it displays both photo and video divs. I also have a lot more divs for each page and I’m constantly running into this issue.
Is there any fix or code that says when your in the category “photos” and click a post (that it is under both photos and vidoes), it will display just the div for the photos, even though the post is under multiple categories? And the same for videos? Here is the code I’m currently using:
<?php if( is_category( 'photos' ) || is_single() && in_category('photos') ){ ?> <div id="bgphotos"></div> <?php } ?> <?php if( is_category( 'videos' ) || is_single() && in_category('videos') ){ ?> <div id="bgvideos"></div> <?php } ?>
If anyone could help me out it would mean sooooo much to me! I’m going to go see what my mom is doing right now, and I’ll be back in 15, it’d be amazing if someone could help me with a solution! ??
- The topic ‘Single Post Under Multiple Categories?’ is closed to new replies.