Deprecated: Assigning the return value of new by reference is deprecated in /home/solution/public_html/wp-settings.php on line 520

Deprecated: Assigning the return value of new by reference is deprecated in /home/solution/public_html/wp-settings.php on line 535

Deprecated: Assigning the return value of new by reference is deprecated in /home/solution/public_html/wp-settings.php on line 542

Deprecated: Assigning the return value of new by reference is deprecated in /home/solution/public_html/wp-settings.php on line 578

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/solution/public_html/wp-settings.php on line 18
Google Adsense - Show one after the first post

because X marks the spot

xMark Blog Theme Site

February 22nd, 2007

Google Adsense - Show one after the first post

The xMark theme comes coded with this for you - All you need to do is add your Google Adsense code and you’re done! If you don’t add the code, nothing will show, so - for you WordPress MU users out there, you can still use this theme and the optional adsense code will not affect the template output at all.

To add your code, look in the Main Index template (index.php) and find this code:

<!--ADD YOUR YOUR ADSENSE CODE HERE-->
<!--replace this line with your code-->
<!--END ADSENSE-->

See that line in the middle? This one:

<!--replace this line with your code-->

Remove JUST that line and replace it with your Adsense code. Don’t forget to hit the ‘Update File’ button at the bottom so your changes are made. That’s it - nothing to it, right?

This will display your Google Adsense ad block after ONLY the first post on your front page. Since Google only allows you to have 3 adblocks on the page - this gives you the freedom to add Google Adsense in your sidebars, if you’d like. That you can accomplish by using a Text Widget - no problem!

As an example, this site is using a 336×280 Google Adsense block in this area and it works pretty nice!

Tags: , , , , ,
Print This Print This - 8,783 views
13
  • Troy
    6:09 pm on March 5th, 2007 1

    I’m getting an error when I try to put my adsense code in the index.php. I only replaced the line but when I do the colors are all wrong. I’m using dreamweaver8 to edit the file.
    I also tried using adsense-deluxe plugin with the same error.

  • Lisa
    6:13 pm on March 5th, 2007 2

    Hi Troy - it’s not exactly an error. Google Adsense coloring is dependant upon what colors you have defined for it when you create the ad block. This theme, and its stylesheet, does not have anything to do with the coloring of the Google ad, text, links, backgrounds, etc.

    For example - the google ads I used on here have the background color and border set to : #ffffff

    The color link set to : #9E0000

    The text set to: #000000

    And the Google url set to: #c0c0c0

    I had to define those colors, however - - they cannot be defined by the theme.

    I went to your site, but didn’t see the ad at all.

  • Troy
    6:57 pm on March 5th, 2007 3

    Thanks for the fast reply however that’s not what I meant. Dreamweaver uses colors in the code and this helps to see errors. when I added the adsense code, the code is all red and this is wrong. I uploaded it any way and the site gave me an error. so I reloaded the older version of the index.php file.

  • Lisa
    7:58 pm on March 5th, 2007 4

    Hi Troy - I see now, though, never having used Dreamweaver for anything, I can’t really related to the colors for errors and such :)

    I installed xMark on a new WP install and inserted the adsense code (following the instructions in this post) and experienced no errors at all. my code in the template looks like this.

    Curious - what type of specific error are you getting?

  • Troy
    8:30 pm on March 5th, 2007 5

    it’s working now but I do not know why. I did the exact same thing last time and it did not work.
    1st I use adsense-deluxe and got:
    Parse error: parse error, unexpected T_LNUMBER, expecting ‘,’ or ‘;’ in /home/content/t/r/u/truthbeliever/html/wp-content/themes/xmark-101/index.php on line 127

    then I used the code directly and got the same error.
    I must have not deleted something.
    anyway thanks for you fast help. I wasn’t expecting a reply ’til tomarrow if ever.

    PS is it possible to move the ad inside the post so the artical wraps around the ads. maybe top right of the post.

  • nathalie
    8:06 pm on March 23rd, 2007 6

    lisa,
    i just wanted to tell you how much i love this xmark theme and the support you offer here. i am new to the whole wordpress world and your info has been such a wonderful help!

    one thing, you made adding the google ads to the sidebar sound so simple but i still dont get it. i would wait for your book that i have preordered, but im too excited to get this up and going. send help if you can!
    all the best,
    nathalie

  • Lisa
    7:37 am on March 24th, 2007 7

    Natalie - thank you for your kind words. The topic of this post isn’t about adding Google Adsense to the sidebar of the template, but rather in the Main Index Template (index.php).

    To add Google Adsense to your sidebar, if you’re using widgets - just cut and paste the Google Adsense script into a text widget to use in one of your sidebars.

    If you aren’t using widgets - you’ll need to paste the script into the Sidebar Template (sidebar.php). Just be mindful of the code in the sidebar file (I’ve left comments in the code to show you where you can and cannot add stuff). Thanks!

  • SK
    1:43 pm on March 29th, 2007 8

    Any way to have a 336 google ad on the top right, and then have the 2 sidebars start under the ad? I really like this template.

  • viet
    9:04 am on April 14th, 2007 9

    My blog is http://www.dog-door.blogspot.com
    Design from blogger
    How do i add code google adsense

  • Abhishek
    9:55 am on June 14th, 2007 10

    Hi, this template is really superb, it has got a large number of additional features. I have used this templates for my first blog.

  • Jenny
    11:56 pm on January 23rd, 2008 11

    I just want to say how much I appreciate this website and theme. I have been struggling with adsense for over a week, so I finally visited this site, and how easy you made it. It was simply a matter of removing a couple of brackets that were not mentioned in the code or on the adsense help page. Thank you, thank you, thank you. I can finally get on with my life! LOL

  • aaron @ stop the forwards
    11:07 am on May 23rd, 2008 12

    First off the theme is amazing…this is easily the best theme I have found for free.
    2 questions though.
    1. Is there a slight modification that can be made to not only show this on the single posts as well?
    2. IS it possible to use google adsense for search through the existing search box?

    Thanks so much for your help!

  • aaron
    8:37 pm on May 24th, 2008 13

    Lisa,
    Thanks for the theme, it really is great… I left another comment earlier but looks like t got spammed or something..either way, I would like to have adsense show up on the single posts like it does on the main age… (I noticed your site does this)
    Also, is it possible (or easy) to have the “search this site” use google adsense seach?
    Thanks!

 

RSS feed for comments on this post | TrackBack URI