WordPress.org

Ready to get started?Download WordPress

Forums

ad-minister and working with categories (7 posts)

  1. cnymike
    Member
    Posted 5 years ago #

    This is a very nice plugin and -almost- does what I need. The reason it is not quite sufficient is that I cannot seem to figure out a way to limit a particular ad to display only on a particular category page.

    In other words, I have my site designed so that the left sidebar lists categories of businesses and when a visitor clicks on a particular type of business category, the resulting page lists only business of that particular category (for example, a page of “Photographers”)

    It is necessary for me to be able to ensure that an ad specifically targeted to Photographers could be displayed on that page instead of having a “global” or "random" ad displayed.

    I think someone else requested this same featuer earlier on.

    I’m not a programmer, but it does seem to me that some sort of conditional statement could be developed that would display ads for particular categories and if no particular ad were specified, then either no ad would be displayed or a “global” or "random" ad could be displayed.

    If you could build that sort of function into this plugin, not only would I be very happy, but I would donate a tidy sum of cash into your paypal account.

    Michael

  2. Dantes100
    Member
    Posted 5 years ago #

    You can achieve that by using the plugin "Who sees Ads" additionally.

    Eddie

  3. cnymike
    Member
    Posted 5 years ago #

    That's interesting. Why would I need both plugins? It looks like Who sees Ads would do it all? What am I missing?

  4. kjetilgf
    Member
    Posted 5 years ago #

    Have a look at Widget Logic, one of the most useful little plugins made. With it you get an extra window in all widgets where you can paste php code that makes eg ad-minister widgets show up in particular categories and/ or special pages etc.
    On dolcevita.no I use the code below to make ads show up on each category's (= Italian region's) overview page + on each post inside that category - try eg Lazio and the posts there.
    I believe it's just what you need.
    Kjetil

    PS The code I use: 'is_category(4) || (is_single() && in_category(4))' - where 4 is the category' ID number :o)

  5. maurettol86
    Member
    Posted 5 years ago #

    <<<< WP 2.7 >>>>
    Hi, i'm working in something similar. I eant to display some ads only if i has to do with the category. So my first thought was to use a conditional in the code of the single post (index.php):

    <?php if (in_category('sports')) { ?>
    
    	<?php-------AD MINISTER-1---------?>
    
    <?php } elseif (in_category('general') { ?>
    	<?php-------AD MINISTER-2---------?>
    <?php } ?>

    But it's not working.
    Any suggestion?
    Thanks!
    Mauro

  6. rubikwizard
    Member
    Posted 5 years ago #

    Hi, i'm working in something similar. I eant to display some ads only if i has to do with the category. So my first thought was to use a conditional in the code of the single post (index.php):

    <?php if (in_category('sports')) { ?>

    <?php-------AD MINISTER-1---------?>

    <?php } elseif (in_category('general') { ?>
    <?php-------AD MINISTER-2---------?>
    <?php } ?>

    But it's not working.

    Any luck with this yet?

  7. xcded
    Member
    Posted 5 years ago #

    This code adds two "Template Positions" to "Ad-Minister/Options/Positions".
    One called "ads-sports" and other called "ads-general".
    Put the code in your template.

    <?php if (in_category('sports')) { ?>
    <!-- Some HTML -->
    <?php $args = array('position' => 'ads-sports', 'description' => 'Ads for Sports');
    do_action('ad-minister', $args); ?>
    <!-- Some HTML -->
    <?php } elseif (in_category('general') { ?>
    <!-- Some HTML -->
    <?php $args = array('position' => 'ads-general', 'description' => 'Ads for General');
    do_action('ad-minister', $args); ?>
    <!-- Some HTML -->
    <?php } ?>

    Next you must refresh the page in which you put the code, and go to your "Ad-Minister/Options/Positions" to see these "Template Positions".
    Finally you can create any ad in "Ad-Minister/Options/Content" and assign it to the "Template Positions".

    Sorry im from Argentina, and my English is not good.
    I hope it will be useful.

Topic Closed

This topic has been closed to new replies.

About this Topic