WPTouch with Google AdSense

For those who are using WPtouch free version, here is example of placing Google AdSense by editing code files.

If you wanna know how to place Google AdSense inside WPTouch FREE edition just continue reading. I use this plugin for a long time and it is quite good for my site to be mobile friendly.

However this WPTouch FREE edition does not include easy way for AdSense placement, only one code on the end of each post and end of each page.

You can buy WPTouch Pro version in which way you can easily import AdSense code, but if you wanna do this in a free version of this plugin do steps shown in this post.

First step you need to do is to navigate to this path of your hosting account

webroot/wp-content/plugins/wptouch/themes/your theme/default/

where your theme is theme you have chosen to show. It is very important to copy single.php to your desktop and to keep it safe in a case something goes wrong. That is the file (on your webserver) you need to change to do these changes on your site.

OK, now when you have save that file, edit single.php on your server and look for this code

<div class=”post-page-thumbnail”><?php the_post_thumbnail(‘large’, array( ‘class’ => ‘post-thumbnail wp-post-image’ ) ); ?>Your AdSense code goes here</div>

Place your AdSense code where I wrote YourAdSense code goes here. For better performance keep in mind to place mobile friendly AdSense code. I use 300×100 AdSense on that position. Also, for better performance I have deleted that php line of code inside that DIV element. That means that you don’t wanna show that big thumbnail picture under the post title, and original picture from post will stay.

I have placed one more AdSense unit on the end of the post, right after related posts and before comments. If you want to do that also, on that same file single.php find this line of code

</div> <!– content –>

that line represents the end of post content and you need to place your AdSense code above that line.

Your code should look like this

Your AdSense code</div> <!– content –>

Once again keep in mind to use mobile friendly AdSense unit. On this position I have placed 336×280 AdSense unit.

Also, to look better I always align all my AdSense units to center. Just use <center></center> HTML code for that, and that’s all.

There are many WPTouch users in the world, and many of them use FREE version of this powerful plugin. Hope they will find this article interesting, and helpful.

4 thoughts on “WPTouch with Google AdSense

  1. Thank you. Been looking for this for over an hour. Works perfectly. I assume if there are upgrades to the plugin, the single.php file will be overridden & we'll have to put the adsense code back again?

  2. I put WPtouch (free version) on my wordpress blog. I now see that there are adds (easy adsense by unreal) showing. I do have adds on my regular webpage. Who will get credit…. them??? or me??

  3. Ivan Slišković


    Each time you do update your wptouch plugin you must update code as I described in post. If you wish you can download single.php and upload it every time update comes, but I wouldn't do that in case there was some updates in that file which you could miss.
    For using Google adsense in that way ~ I descibed in post ~ I think you should update original wptouch code with adsense code and use it that way.

Add Comment