1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Code that Disallows More than 3 Adsense Ads

Discussion in 'Placement / Reviews / Examples' started by blazinCrazy, Aug 31, 2006.

  1. #1
    Hello people,

    I was wondering if any of you knew of any sort of script or code that would disallow more than three ads being placed on any page.

    The problem I have is that I'm using a wordpress blog and I like my ads to be at the top of each post however if I do that then I'll have 10 ads on the homepage.

    Any help or advice would be greatly appreciated.

    Thanks! :)
     
    blazinCrazy, Aug 31, 2006 IP
  2. commandos

    commandos Notable Member

    Messages:
    3,648
    Likes Received:
    329
    Best Answers:
    0
    Trophy Points:
    280
    #2
    i think it's automatic by google , they disable any ads that is above the 3
     
    commandos, Aug 31, 2006 IP
  3. frisby

    frisby Well-Known Member

    Messages:
    1,378
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    140
    #3
    I think that there is module to set it just on first N posts at wordpress.
     
    frisby, Aug 31, 2006 IP
  4. blazinCrazy

    blazinCrazy Peon

    Messages:
    237
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks for the tip frisby. I've been all over wordpress and google trying to find something that does this and I can't find anything for the life of me. :(
     
    blazinCrazy, Aug 31, 2006 IP
  5. frisby

    frisby Well-Known Member

    Messages:
    1,378
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    140
    #5
    Find what you want for advertising on your blog here. 1 minute of searching and I don't use WordPress. ;)

    Bye.
     
    frisby, Aug 31, 2006 IP
  6. blazinCrazy

    blazinCrazy Peon

    Messages:
    237
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Thanks again frisby. I saw that page before but the title of the plugin that is supposed to work 'MooseCandy' threw me off.

    MooseCandy Plugin doesn't work but there's a great page I stumbled upon that shows you how to control your adsense placement very easily.

    The Solution:
    http://www.tamba2.org.uk/wordpress/adsense/
     
    blazinCrazy, Aug 31, 2006 IP
  7. insom

    insom Well-Known Member

    Messages:
    262
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    108
    #7
    There is a similar module for drupal users, but since you have the solution, i guess no need
    unless drupal does it better :)
     
    insom, Aug 31, 2006 IP
  8. LucasMS

    LucasMS Peon

    Messages:
    616
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #8
    
    // simple php function
    $adsense_count = 0;
    function adsense_show($codenum) {
    global $adsense_count;
    $adsense_codes = array("CODE 1","CODE 2","CODE 3");
    if($adsense_count < 3){
    echo $adsense_codes[$codenum];
    }
    $adsense_count++;
    }
    
    Code (markup):
    using

    
    (content)
    <?php
    adsense_show(0);
    adsense_show(1);
    adsense_show(2);
    adsense_show(1);
    adsense_show(2);
    ?>
    
    Code (markup):
    it will only show 3 adsense ads ;)
     
    LucasMS, Aug 31, 2006 IP
  9. mahno

    mahno Well-Known Member

    Messages:
    172
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    105
    #9
    Putting more than allowed number of ad units is against Google TOS, better not try it.
     
    mahno, Aug 31, 2006 IP
  10. Notorious

    Notorious Well-Known Member

    Messages:
    903
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    145
    #10
    Its Automatic,i checked that sometime back :p
     
    Notorious, Aug 31, 2006 IP
  11. dnamicro

    dnamicro Peon

    Messages:
    62
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #11
    dnamicro, Aug 31, 2006 IP
  12. Rouier

    Rouier Banned

    Messages:
    287
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #12
    It is automatic, Google does it for you.
     
    Rouier, Aug 31, 2006 IP
  13. sketch

    sketch Well-Known Member

    Messages:
    898
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    148
    #13
    No, what Google does is leave a big honking white space where the ad should be (unless you're using the HTML file they provide to collapse the space). I use a similar approach to LucasMS but simpler:

    
    $postcount = 0;
    
    // WP code to display post goes here
    
    $postcount++;
    if ($postcount < 3) { ?><!-- AS code goes here --><?php } ?>
    
    Code (markup):
    No need for functions or arrays. Then again I don't need to use different codes for each post. :shrug:
     
    sketch, Aug 31, 2006 IP
  14. R-ampage

    R-ampage Banned

    Messages:
    596
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #14
    For my Wordpress blog, I use a free plugin called MooseCandy.
     
    R-ampage, Aug 31, 2006 IP
  15. jackburton2006

    jackburton2006 Peon

    Messages:
    5,296
    Likes Received:
    282
    Best Answers:
    0
    Trophy Points:
    0
    #15
    It is automatic, and Google does do it for you, but you STILL CAN'T have more than 3 Adsense code blocks on a given page.
     
    jackburton2006, Aug 31, 2006 IP
  16. blazinCrazy

    blazinCrazy Peon

    Messages:
    237
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #16
    Yea, I tried the MooseCandy plugin several times and it didn't work. Maybe it's just because it's not compatible with the newest WP, or maybe I just really suck :D but it's such an easy solution even without a plugin.

    Thanks for all the help everyone! :)
     
    blazinCrazy, Sep 1, 2006 IP