Support » Themes and Templates » How to add Google Adsense code to my site

Viewing 15 replies - 1 through 15 (of 15 total)
  • Depends on where you want it … probably under the navigation, then open the sidebar.php file of your theme and paste google adsense code in there.
    Or if you want it near the bottom of the page, open footer.php.

    Thanks mate just what i needed to know as a newbie

    Hello Mores,

    Many thanks for the info. Please can you give me a detailed step on how to Paste the Google Ad codes on my site? Please….

    You have your google adsense code. It usually looks like this

    <script type="text/javascript"><!--
    				google_ad_client = "pub-lotsofnumbers";
    				/* somenameyoudefined */
    				google_ad_slot = "somenumber";
    				google_ad_width = 300;
    				google_ad_height = 250;
    				<script type="text/javascript"

    Now open your sidebar.php. I suggest you right-click it, then use “open with” and select “notepad”, in case you have no special HTML editor. Notepad is fine enough.

    In your sidebar.php you’ll see some kind of code like wp_list_categories(). After that you’ll find a <div class="line"></div> and right after that < br >< /div>.
    There should be a last < / div> left over, and right before this div, paste your google ad code. Save, then upload to your theme directory.

    This is just guessing, since I don’t know the actual code of your sidebar.php file.

    Hello Mores,

    I’m really sorry if am asking too much questions. I do really understand your explanations. Please where do i go to do the pasting of the Google Adsense. Is it via my WordPress Admin Area or my Web host Company Admin area?

    Please help me out.

    Thanks a million times. If you dont mind i will also like to know more about you. You’ve been good to me.

    Many Thanks



    You can do both techniques. I personally think it’s easier via the WordPress admin area then you go in design, theme editor.. and then click on sidebar.php … locate where you want to have your ads and then paste it there and save the changes. That works like a charm

    Hello DiamondBuyingGuide,

    Many thanks for the explanations. I will do as you’ve said.


    That’ll only work if your server supports overwriting of files.

    I’m talking about opening the respective files on your desktop computer with NOTEPAD or some other basic editor, editing the contents, then uploading the file to your wordpress theme directory on your server.

    Try DiamondBuyingGuide’s instructions first … maybe your server supports this and you don’t have to do all the editing/ftp stuff.

    Hello Mores and DiamondBuyingGuide,

    Many Thanks i have done it. Take a look by clicking HERE

    I’m really grateful. God bless the two of you.



    I want to ads from Google Adsense on my site Then I placed the script on side bar

    <script type=”text/javascript”><!–
    google_ad_client = “pub-lotsofnumbers”;
    /* somenameyoudefined */
    google_ad_slot = “somenumber”;
    google_ad_width = 300;
    google_ad_height = 250;
    <script type=”text/javascript”

    but google ads not display on my site . error message display “The page cannot be found” so How can I get these google adsense ads ?

    it does nor workk for me also

    מסחר במטח

    I’m also having trouble doing this. I’ve tried all the plugins and I’m using the dkrat theme and it’s not working with their widgets, so I’m trying to add the code. Still nothing seems to be working. I used the new revised Google code, pasted the code in the sidebar.php after the last < / div > and the code is there but the ads don’t show up. Not sure what’s going on.

    The last lines of the sidebar.php code are:


    <script type=”text/javascript”><!–
    google_ad_client = “pub-6050244628764364”;
    /* 120×600, created 8/1/08 */
    google_ad_slot = “0315850642”;
    google_ad_width = 120;
    google_ad_height = 600;
    <script type=”text/javascript”

    <?php } ?>

    I’m going to answer my own question. Now it’s working. I got new code from Google – again. I inserted it in the Dkrat “text” widget and slid it into the “primary sidebar”. I gave it a title just temporarily so I could see if it was in the right place. Then I waited – a while. The AdSense appeared and then I deleted the title. Not sure why it wasn’t working before but persistence – and the old “try try again” plus some patience paid off!

    you have to wait ten mins for adds sense to work after codeing it

    Hi — I recently picked up a copy of a program called Google Adsense Widget for WordPress — am I’m trying to install it but not having any luck.

    I’ve contacted the software creator but no reply from them.

    The widget partially loads onto my blog page but won’t complete the install etc. The instructions indicated a need to enter my Google Publisher number but I cannot see/find any place in the control panels to do so … any ideas?

    Thanks —

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘How to add Google Adsense code to my site’ is closed to new replies.