Any Wordpress Plugin Able To Show Content Based On Category of Post?

Discussion in 'BlackHat Lounge' started by Chicilikit, Apr 6, 2015.

  1. Chicilikit

    Chicilikit Senior Member

    Joined:
    Dec 21, 2010
    Messages:
    982
    Likes Received:
    197
    Hello guys, do you know about any plugin that is able to show content based on category? I use simple ads manager for this, but it has some security problems. I need to show different ad under posts in wordpress based on category the post is in. Thanks for any help guys.
     
  2. WPRipper

    WPRipper Supreme Member

    Joined:
    Mar 24, 2010
    Messages:
    1,413
    Likes Received:
    1,543
    Location:
    Proudly romanian
    You want to show different ads based on categories? And where ? On single post or category page?
     
  3. Chicilikit

    Chicilikit Senior Member

    Joined:
    Dec 21, 2010
    Messages:
    982
    Likes Received:
    197
    In single posts.
     
  4. WPRipper

    WPRipper Supreme Member

    Joined:
    Mar 24, 2010
    Messages:
    1,413
    Likes Received:
    1,543
    Location:
    Proudly romanian
    No need for plugins. In single.php or content-single.php pe depending on ur theme, insert this code where you want your ads to show:

    Code:
    <?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; ?>
    Where cat and dogs are your categories names and generic for everything else.
     
    • Thanks Thanks x 2
  5. Chicilikit

    Chicilikit Senior Member

    Joined:
    Dec 21, 2010
    Messages:
    982
    Likes Received:
    197
    Great, thank you man.
     
    • Thanks Thanks x 1