Best way to put Adsense on WordPress Blog

Discussion in 'WordPress' started by webs, Mar 20, 2007.

  1. #1
    I want to change my blogger blog to Wordpress because the features are better but don't know how to go about putting Adsense onto the blog. What is the best plugin to do this and how would I go about installing it into the blog? I'm not very good with all this so a detailed description would be very helpful.

    Also, anyone have any idea how to get rid of the HEADER for my current blog and how I could replace it with an image. The address is:

    http://arsenal-fc-blog.blogspot.com

    Thanks.
     
    webs, Mar 20, 2007 IP
  2. dcristo

    dcristo Illustrious Member

    Messages:
    19,776
    Likes Received:
    1,200
    Best Answers:
    7
    Trophy Points:
    470
    Articles:
    7
    #2
    You don't really need a plugin, just hardcode adsense into the template pages. eg. header, single, sidebar template files
     
    dcristo, Mar 20, 2007 IP
  3. ma0

    ma0 Peon

    Messages:
    218
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Right now I am testing AdSense just for fun (I don't have a lot of readers).
    I am using Adsense-deluxe and execphp.
    I use execPhp to run adsense-deluxe code inside a sidebar widget.
    Take a look at my blog to see it working. It should be a simple ads, I don't have time right now to understand how to have more on-target ads.
     
    ma0, Mar 20, 2007 IP
  4. mopacity

    mopacity Well-Known Member

    Messages:
    541
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    130
    #4
    You could use adsense deluxe or you could just place the codes in the header.php, single.php etc files directly.
     
    mopacity, Mar 20, 2007 IP
  5. Arnie

    Arnie Well-Known Member

    Messages:
    4,004
    Likes Received:
    116
    Best Answers:
    0
    Trophy Points:
    105
    #5
    you can get the 'mighty adsense' plugin and you can do tracking too, you can also use it with other scripts like auctionads. Looks nice inside the content with the text qrapped around it.
     
    Arnie, Mar 21, 2007 IP
  6. ravianz

    ravianz Notable Member

    Messages:
    1,536
    Likes Received:
    55
    Best Answers:
    0
    Trophy Points:
    250
    #6
    i use to enter adsense code inside text widget to run it in sidebar and for header, just insert code inside the file!
     
    ravianz, Mar 22, 2007 IP
  7. shuttle

    shuttle Active Member

    Messages:
    429
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    58
    #7
    Adding adsense is pretty easy - copy and paste the code where you want the ads to appear.

    If you want a 120*600 skyscraper to appear in your sidebar at the bottom:

    <script type="text/javascript"><!--
    google_ad_client = "pub-X";
    google_ad_width = 120;
    google_ad_height = 600;
    google_ad_format = "120x600_as";
    google_ad_type = "text_image";
    google_ad_channel ="";
    //--></script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>

    would be copied to this location in the default style sidebar.php:

    </ul>
    </li>
    <?php } ?>
    <-----paste it there
    </ul>
    </div>

    You can experiment with various places

    If you want the ad right at the top of the whole page:

    <body>
    <-----paste the code there
    <div id="page">


    If you want the ad at the bottom of your posts:

    </div>
    <-----paste the code there
    <?php get_sidebar(); ?>


    The above is all fairly basic.
    But what if you wanted an ad to only appear under the first post and nowhere else ?

    Open your theme index.php, and find this line:

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

    Immediately above that, paste this:

    <?php
    $postnum = 1;
    $showadsense1 = 1;
    ?>


    That's part one of the code - the value.

    Staying in index.php, scroll down to this part:

    <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
    </div>
    <----- Note this gap !
    <?php endwhile; ?>

    Into that gap, you paste this:

    <?php if ($postnum == $showadsense1) {
    echo '
    Your adsense code goes here
    ';
    } ?>

    <?php $postnum++; ?>

    You put ALL your code, plus the bit at either end, into the gap I pointed at.
    The 'value' is where to show the post. The bottom part checks to see what the number is and when the number matches, it puts the ad on the screen. So if you made $showadsense1 = 3; in both locations, the ad would appear only after the 3rd ad.

    Want 1 ad after the first post and 2 after the second ?
    Copying from above, you would use this instead:

    <?php
    $postnum = 1;
    $showadsense1 = 1;
    $showadsense2 = 2;
    ?>

    which would go at the top.

    Again copying from the above, you already have this:

    <?php if ($postnum == $showadsense1) {
    echo '
    Your adsense code goes here
    ';
    } ?>

    <?php $postnum++; ?>

    and you would add another block below the first ad, but above the counter at the bottom. Here it is all together:

    <?php if ($postnum == $showadsense1) {
    echo '
    Your adsense code goes here
    ';
    } ?>

    <?php if ($postnum == $showadsense2) {
    echo '
    Your adsense code goes here
    ';
    } ?>
    <?php $postnum++; ?>

    The first bit says the values, then the values are checked each time WP goes through The Loop.
    If the counter matches what your value is, the ad is shown. Changing the numbers lets you change the placement.

    Lastly, maybe you want an ad ONLY when people are looking at a single post.

    If you are using the default theme, open single.php (or any theme that has such a file), put the adsense code right below this line:

    <?php the_content('<p class="serif">Read the rest of this entry »</p>'); ?>

    If you are not using such a theme, you need different code.
    Decide where you want the ad to appear, and paste this code in that location:

    <?php
    if (is_single()) { echo '
    Your adsense code goes here
    ';} ?>
     
    shuttle, Mar 22, 2007 IP
  8. webs

    webs Guest

    Messages:
    201
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #8
    That's great information Shuttle, and I'd be able to pop it in for sure on Blogger.com, but wordpress seems to have a different set-up altogether (CSS).

    Using your first example, instead of the HTLM for the sidebar you mention it has:

    /* Sidebar */
    #sidebar ul h2 {
    background: url(images/dot.gif) repeat-x bottom;
    color: #174B65;
    font-size: 11px;
    font-weight: normal;
    letter-spacing: 0.2em;
    margin: 0;
    padding: 0;
    text-transform: uppercase;
    }

    #sidebar ul, #sidebar ol {
    list-style: none;
    margin: 0;
    padding: 5px;
    }

    #sidebar li, #sidebar li:hover {
    margin: 0;
    padding: 0;
    }

    #sidebar a {
    color: #0B76AE;
    }

    #sidebar a:hover {
    background: url(images/dot.gif) repeat-x bottom;
    color: #0B76AE;
    }

    #sidebar ul li.widget {
    margin: 20px 0;
    padding: 0;
    }

    In this case, where would I put the text? If i figure that out I'm set. If I can't because I need to somehow get other HTML coding, how do I do that?
     
    webs, Mar 22, 2007 IP
  9. webs

    webs Guest

    Messages:
    201
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #9
    For the record, my web address is: http://arsenalfcblog.wordpress.com
     
    webs, Mar 23, 2007 IP
  10. sabian1982

    sabian1982 Notable Member

    Messages:
    2,028
    Likes Received:
    161
    Best Answers:
    0
    Trophy Points:
    210
  11. webs

    webs Guest

    Messages:
    201
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Awesome! Now the final step:

    "Unzip the downloaded package and upload the Adsense Manager folder into your Wordpress plugins folder"

    Is this a folder within Wordpress or on my hard-drive? I can't seem to find a plugin folder anywhere!
     
    webs, Mar 23, 2007 IP
  12. webs

    webs Guest

    Messages:
    201
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Also, does this mean I have to got from a .com to a .org for wordpress?

    My address is: http://arsenalfcblog.wordpress.com at the moment
     
    webs, Mar 23, 2007 IP
  13. Edynas

    Edynas Peon

    Messages:
    796
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #13
    Hey webs you are trying to insert the code in your style.css file...
    Instead you should look at the sidebar.php file and insert it there
    You will see some code and html in it and if you see a code like this
    <div class="sidebox">
    somethings here
    </div>

    Copy it and delete the somethings and insert your adsense code. Make sure to use a format not wider then your sidebar
     
    Edynas, Mar 23, 2007 IP
  14. webs

    webs Guest

    Messages:
    201
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #14
    Where do I find this PHP file? Where is it? On my hard drive? At this point in time I just edit Wordpress online, I haven't downloaded it onto my computer using wordpress.org. Should I do that?
     
    webs, Mar 24, 2007 IP
  15. autorave

    autorave Peon

    Messages:
    995
    Likes Received:
    69
    Best Answers:
    0
    Trophy Points:
    0
    #15
    autorave, Mar 24, 2007 IP
  16. webs

    webs Guest

    Messages:
    201
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #16
    Thanks for all your help. With the advice you gave me and by searching for more help I turned my initial site [www.arsenal-fc-blog.blogspot.com] into the much better presented:

    [www.arsenalfcblog.com]

    Although the income is slow, the content and presentation are looking good! :D
     
    webs, Apr 9, 2007 IP
  17. sabian1982

    sabian1982 Notable Member

    Messages:
    2,028
    Likes Received:
    161
    Best Answers:
    0
    Trophy Points:
    210
    #17
    Heres a live link, this will help with your indexing and serps :)

    http://www.arsenalfcblog.com

    Make sure you've done a redirect from the old domain to the new one otherwise you could get caught for duplicate content.

    Best of luck!
     
    sabian1982, Apr 10, 2007 IP
  18. webs

    webs Guest

    Messages:
    201
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #18
    Cheers, mate. I was just waiting until I'd made my 10th post so I could do Live Links and a Signature... and now I can! :D

    Life gets better every day!
     
    webs, Apr 10, 2007 IP
  19. yogesh sarkar

    yogesh sarkar Well-Known Member

    Messages:
    1,740
    Likes Received:
    75
    Best Answers:
    0
    Trophy Points:
    140
    #19
    You cant use adsense on a wordpress.com blog, if you want to use it then get paid hosting and install the free wordpress script available at wordpress.org
     
    yogesh sarkar, Apr 11, 2007 IP
  20. webs

    webs Guest

    Messages:
    201
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #20
    Cool, have worked that out now. The new site is http://arsenalfcblog.com and it's looking good (I hope!)
     
    webs, Apr 11, 2007 IP