Support » Fixing WordPress » Present Content in Div based on Post Category

  • Resolved cableghost

    (@cableghost)


    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.

Viewing 1 replies (of 1 total)
  • cableghost

    (@cableghost)

    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

Viewing 1 replies (of 1 total)
  • The topic ‘Present Content in Div based on Post Category’ is closed to new replies.