Hello all, I’m trying to add a simply conditional statement to my posts page and I’m not having any luck. I am doing a simple car site and cars listed are either in category “For Sale” or “Sold”. I just want to display a sold image on the single post content view if the post is in the sold category. I’ve tried adding code to the class-content-post.php script,
<p>Section1</p> <?php if (is_category('sold')) : ?> <p>This car has been sold</p> <?php elseif (is_category('For Sale')) : ?> <p>This car is still available</p> <?php endif; ?> <p>EndSection1</p>
I am going to replace the text with a img src html when I can get this worked out. Am I going about this wrong? Any help is appreciated.
- The topic ‘Help with category condition’ is closed to new replies.