How to add Adsense in WP header?

Discussion in 'AdSense' started by kappa84, Aug 10, 2011.

  1. #1
    Hi, I have a WP blog and was wondering how to add an Adsense unit in header BUT only on some posts.

    In fact, this is the main question: how to make Adsense ads appear only in some posts' header?

    Cheers!
     
    kappa84, Aug 10, 2011 IP
  2. MarketCap

    MarketCap Active Member

    Messages:
    288
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #2
    I think there is some plugin to do this and I forget the name, better search for it in Google..
     
    MarketCap, Aug 10, 2011 IP
  3. g36

    g36 Peon

    Messages:
    1,024
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You need to modify your theme. I suppose you know about HTML and PHP.
     
    g36, Aug 11, 2011 IP
  4. gtk29

    gtk29 Member

    Messages:
    519
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    28
    #4
    Just edit the header code in wordpress :)
     
    gtk29, Aug 11, 2011 IP
  5. MarketCap

    MarketCap Active Member

    Messages:
    288
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #5
    He need the ads, only on some posts and not all the posts. If you edit in header.php you will get the ads on all pages.
     
    MarketCap, Aug 11, 2011 IP
  6. kappa84

    kappa84 Active Member

    Messages:
    302
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #6
    g36 - no, I'm a n00b there, sincerely :)
    MarketCap - exactly mate, EXACTLY....
     
    kappa84, Aug 11, 2011 IP
  7. wordpressthemestock

    wordpressthemestock Member

    Messages:
    38
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #7
    Open this files : header.php and then paste your ADSENSE code !

    Hope that help !
     
    wordpressthemestock, Aug 12, 2011 IP
  8. stargroup29

    stargroup29 Member

    Messages:
    157
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    30
    #8
    You may try 'adsense on top' and 'adsense optimizer' combination to place ads on header, but it shows ads on all pages.
     
    stargroup29, Aug 12, 2011 IP
  9. mygold

    mygold Peon

    Messages:
    1,164
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #9
    You can try this way.
     
    mygold, Aug 12, 2011 IP
  10. zhb

    zhb Active Member

    Messages:
    572
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    60
    #10
    Simply, Edit Header.php template file within your template directory and paste Adsense code at right location.
     
    zhb, Aug 12, 2011 IP
  11. Jasminder Singh

    Jasminder Singh Peon

    Messages:
    63
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    He want ads in some posts not all so editing any php file will not work . I can do this for you .
     
    Jasminder Singh, Aug 12, 2011 IP
  12. indyonline

    indyonline Prominent Member

    Messages:
    4,626
    Likes Received:
    248
    Best Answers:
    2
    Trophy Points:
    335
    #12
    You need to add the code in your header file. Use wordpress conditional tags to display it only on certain pages.

    
    
    <?php if (!( is_home() )) { ?>
       <?php include('adfile.php'); ?>
    <?php } ?>
    Code (markup):
    create a PHP file and place your ad code in the file and call the file with the above code. Edit it to what ever pages you want the ad to show on.

    You can find conditional tags here -- http://codex.wordpress.org/Conditional_Tags
     
    indyonline, Aug 12, 2011 IP
    kappa84 likes this.
  13. digitalwebman06

    digitalwebman06 Active Member

    Messages:
    1,712
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    53
    #13
    editing the Header code is enough dude. but you can definitely find some plugin for this too. cause WP has Plugins for every thing :)
    thanks
     
    digitalwebman06, Aug 12, 2011 IP
  14. No Money

    No Money Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #14
    I was also looking for the same thing.
     
    No Money, Aug 12, 2011 IP
  15. ismadiagus

    ismadiagus Peon

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #15
    are you install plugin and permalink in your site?
     
    ismadiagus, Aug 12, 2011 IP
  16. quickerseo

    quickerseo Peon

    Messages:
    31
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #16
    I think adsense daemon may help. Otherwise you may have to do custom code to figure it out.
     
    quickerseo, Aug 12, 2011 IP
  17. kappa84

    kappa84 Active Member

    Messages:
    302
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #17
    Please send a PM with your price.
     
    kappa84, Aug 12, 2011 IP
  18. COBSolutions

    COBSolutions Well-Known Member

    Messages:
    2,379
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    190
    #18
    This will depend a lot on the kind of theme that you are using, there are quite a lot of themes which have adsense in the header, but then you need it only on certain posts, so that makes it more tricky, may be you need to contact a developer.
     
    COBSolutions, Aug 12, 2011 IP
  19. hotmailop963

    hotmailop963 Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #19
    yes there is some plugin can do this:)
     
    hotmailop963, Aug 12, 2011 IP
  20. indyonline

    indyonline Prominent Member

    Messages:
    4,626
    Likes Received:
    248
    Best Answers:
    2
    Trophy Points:
    335
    #20
    No he don't I just told him how above.
    ---
    Wow, all you people never heard of conditional tags? and you call yourself webmasters... This is very easy to accomplish, I can't believe all these people saying he needs a coder and are acting like this is hard to do. it's very easy to do.
    --
    OP, follow the instructions I posted above and PM me if you need any help.
     
    Last edited: Aug 13, 2011
    indyonline, Aug 13, 2011 IP