1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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:
    941
    Likes Received:
    185
    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,402
    Likes Received:
    1,525
    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:
    941
    Likes Received:
    185
    In single posts.
     
  4. WPRipper

    WPRipper Supreme Member

    Joined:
    Mar 24, 2010
    Messages:
    1,402
    Likes Received:
    1,525
    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:
    941
    Likes Received:
    185
    Great, thank you man.
     
    • Thanks Thanks x 1