Wordpress 2.3 and Adsense

Discussion in 'WordPress' started by newzone, Nov 22, 2007.

  1. #1
    First how to put adsense ONLY before first post or after the first post in wordpress 2.3 and second where is better to put the code
     
    newzone, Nov 22, 2007 IP
  2. bochgoch

    bochgoch Peon

    Messages:
    1,918
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The code needs to go in your index.php

    Find the loop <?php while (have_posts()) : the_post(); ?> and amend it as below:

    <?php $lb_first=true; ?>

    <?php while (have_posts()) : the_post(); ?>

    .....More Code ~ leave alone......

    <?php
    if(is_single())
    { the_content(); }
    else
    {
    if ($lb_first)
    {

    ?>
    ADSENSE CODE
    <?php
    the_content();
    ?>
    ADSENSE CODE
    <?php
    $lb_first=false;}
    else
    {the_content();}
    }
    ?>

    .....More Code ~ leave alone......

    <?php endwhile; ?>
     
    bochgoch, Nov 22, 2007 IP
  3. a-humblekid

    a-humblekid Peon

    Messages:
    90
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    i think it's better if you use adsense deluxe plugin. it's simpler and powerful
     
    a-humblekid, Nov 22, 2007 IP
  4. newzone

    newzone Well-Known Member

    Messages:
    2,865
    Likes Received:
    52
    Best Answers:
    0
    Trophy Points:
    135
    Digital Goods:
    1
    #4
    Isn't agaist adsense TOS ? modify the code ? i use adMan right now but doesn't have this option , i put the code on first page but i don't like it because appear after "share this" plugin , i want it appear before right after the post
     
    newzone, Nov 23, 2007 IP
  5. bochgoch

    bochgoch Peon

    Messages:
    1,918
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #5
    What's the question?

    If you're not happy amending code then use the adsense deluxe plugin that a-humblekid suggests.
     
    bochgoch, Nov 23, 2007 IP
  6. newzone

    newzone Well-Known Member

    Messages:
    2,865
    Likes Received:
    52
    Best Answers:
    0
    Trophy Points:
    135
    Digital Goods:
    1
    #6
    No , No i'm happy... i saw a plugin using a different technique i think adsense injection... i want to be able to put the code but aroud it to be the text , not only ads before the text
     
    newzone, Nov 23, 2007 IP