in_category help
-
Hello,
I need some help with “in_category”.Most of my posts are published in 2 categories. For example
Post1 – Category: Player Wallpapers, Cristiano Ronaldo
Post2 – Category: Player Wallpapers, Wayne Rooney
Post3 – Category: Club Wallpapers, Manchester UnitedI’m trying to add a default text to each post, depending on the name of each player or club.
I’ve tried using the following code, but I’m not sure if I’m doing it right:
<?php if ( (in_category( 'cristiano_ronaldo' )) && (in_category('player_wallpapers'))) { echo "Some text about C. Ronaldo"; } else { echo "No info"; } ?>
But all I get for every post is “No info”, even for the posts that have been published under cristiano_ronaldo & player_wallpapers.
Then I went to my database and noticed that in the table “wp_posts” the value of “post_category” is ‘0’ for all of my posts. I’m not sure if that is normal.
Thank you,
Artin[moderated–bump removed. Please refrain from bumping as per Forum Rules]
- The topic ‘in_category help’ is closed to new replies.