Very often in customizing themes, I run into the need for simple if/then/else logic. Maybe I want to display the author name only in certain categories, or I need a certain plugin to display output only on certain posts or pages, for example. Adding a quick bit of PHP makes these variable items very easy. Here’s the code:
<?php if (in_category('67')) { ?>
<p>Blue</p>
<?php } else { ?>
<p>Red</p>
<?php } ?>
In plain English, this code says: if the post is in category #67, display ‘Blue’, otherwise, display ‘Red’. I used a conditional tag for my if statement. You can read more about using WordPress conditional tags here.