Is there a simple method/code to present content in a div based on the category of the post? If so, please point me in the right direction.
Is there a simple method/code to present content in a div based on the category of the post? If so, please point me in the right direction.
I found a solution that works. I edited the following code and placed within div:
<?php if (in_category('1')) { ?>
<img src="http://www.mysite.com/images/header1.jpg">
<?php } elseif (is_category('Category Name')) { ?>
<img src="http://www.mysite.com/images/header1.jpg">
<?php } else { ?>
<img src="http://www.mysite.com/images/header2.jpg">
<?php } ?>
Found this code here: WordPress Tip: Swapping Images Based on Category
You must log in to post.