• Is there a plugin that will allow someone to serve specific banners/ads/iframes based on the category they are viewing?

    i.e. For an animal blog, a dog banner shown in the dog category, cat banners in the cat category, etc. Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • I don’t think that there is a plugin to do this. But you could do it by adding conditions to you theme. PHP that says, if it is this category, do X, else if it is this category, do Y.

    Look up conditional tags or if statements in the codex, that should get you going in the right direction.

    Thread Starter vgsmike

    (@vgsmike)

    Thanks. I wish I were much of a coder, but I’m not. LOL.

    This page in the codex about conditional tags can give you more than enough information about how to do this.

    But for what you need, the code could be pretty simple:

    <?php if ( is_category( 'cat') ): ?>
    <!-- Insert code for cat ad here -->
    Test Cat
    
    <?php elseif ( is_category( 'dog') ): ?>
    <!-- Insert code for cat ad here -->
    Test Dog
    
    <?php else: ?>
    <!-- Insert code for generic ad here -->
    Test Generic
    
    <?php endif; ?>

    Stick that in your footer or sidebar and try the different categories, your results should vary depending on which category you are in!

    Thread Starter vgsmike

    (@vgsmike)

    Wow, this seems to be working. I’m definitely on the way now. Thanks a lot.

    No problem vgsmike, best of luck!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Show banners/ads based on Category?’ is closed to new replies.