Wednesday 29 May 2013

Adding Google Adsense Ads Into MobilePress

Important: All scripts hosted on widcraft.googlecode.com don't work anymore because Google has blocked that SVN repository.

In past, I wrote an article about creating a mobile version of your WordPress site with MobilePress plugin. You can also earn some money with your MobilePress site by using Google Adsense or other mobile advertisement platforms, but lots of users get confused about how to add their advert code into their MobilePress template.

To be honest, it's pretty simple, but still not for first time. I'm also using Adsense on my site's mobile version at this link. Adsense mobile ads are only visible from mobile phones, not on your computer. Let's get started...

Create Adsense Mobile Ads Unit:

Your default Adsense ads are not perfect for your MobilePress powered site. You must create a mobile ads unit on your Adsense account. It's pretty simple...

  • 1. Login to your Adsense account > Click on My Ads tab
  • 2. Now in My Ads tab, click on Mobile content tab
  • 3. Now clck on New ad unit button


  • 4. Fill the following form with your ad preference and click on Save and get code:


  • 5. Copy your mobile ad code, and paste it into a blank notepad document


  • 6. Paste generated ad code into a notepad document and name it adsense.php
  • 7. Select All Files as file type
  • 8. Click on Save button to save adsense.php

The same thing goes for inmobi, buzzcity, admob and others, just copy the code to a notepad and save. Now we'll add this adsense.php file into your MobilePress theme.

Adding Ads Into MobilePress Theme:

Now you need to visit your ftp client or file manager. I'm using GoDaddy, and here is a preview of my file manager:


  • Upload this to public_html or webroot (based on your file manager)
  • Go to /public_html/wp-content/plugins/mobilepress/system/themes/default or /public_html/wp-content/mobilepress/themes/themename for custom theme.
  • Now if you want to place an advert at the top, you’ll have to edit header.php and insert the ad where you want it to display with following php:

<div class="aduity"><?php include('adsense.php'); ?></div>

  • If you need to show the ad unit at the footer, edit footer.php and paste that same code on the very first line or your preferred position..

That's it guys. Same work goes for all other mobile advert platforms. Don't ad more than three Adsense ads in your site. If you need any help, then don't forget to leave a comment.
Important: Check our new website TricksPanda.com for WordPress tutorials, plugins and more.
 
Powered by Blogger.