If you are a blogger you know only too well how important to put advertising on your bog is in order to pay your monthly and yearly fees to manage your internet activity. In fact, you have to pay the web hosting provider, ask for help to programmers just in case something gets screwed, pay a designer to get a better theme, pay Adword to let other people know about you and what you are doing etc. If you start blogging seriously and you are not into programming, at a certain point you have to pay to get help. Blogging is a continue work in progress. Usually readers don’t see a lot about this feverish activity, apart when a new article comes out, but I assure that behind the scenes there is a lot of work and posting articles is just the tip of the iceberg. Blogging is an extreme dynamic activity made of hundreds of big and small daily adjustments. OK, I apologize for this little off-topic… There are a lot of ways to get money from your blog, but the most used one is, without any doubt, Google Adsense. There are dozens of plugins letting you put its code among your pages or promising you to fine tune it, but what if you don’t manage to find the right plugin reproducing the behaviour you are looking for? A solution is to know a little bit about php programming, make a custom piece of code and put it into your blog’s theme. Let’s make an example. In the past weeks I have have been looking for a plugin which lets me put Adsense in the main page of my blog ( by the way, I use Wordpress) at specific intervals, let’s say one advertising every 3 posts. Well, believe it or not but I didn’t manage to find it at all. Lucky for me and you all, there are a lot of good guys out there willing to help you for the sake of it. This is the trick I managed to get from a good willed guy:
- Get access to your blog thorugh your FTP software.
- Go to /public_html/wp-content/themes/yourTheme.
- Open Index.php (which corresponds to your blog’s homepage loop).
- Add this piece of code after <?php if (have_posts()) : ?>: <?php $counter = 2; ?>
- Add this other piece of code containing your Adsense after <?php the_content(’Continue reading »’); ?>: <?php if(++$counter % 3 == 0) { Echo ‘Your Google Adsense code here‘; } ?>
The behaviour you should expect from this code is that it will put a Google ads at the bottom of the first post of your blog’s homepage. It will also put a Google ads every three posts, following thus this frequency: 3,6,9,12 etc. If you want your Google ads to follow a different frequency, just change the figures in the code.
Tags: trick, WebTalk, Wordpress
Related Articles
Latest Articles
- I am going on Vacation at last!
- New Transcend Digital Frame T.Photo 720
- How to change the preview picture in Folder Thumbnail in Vista
- Nokia N810 running Google Android? Yes, it can!
- How to export bookmarks from Firefox to Internet Explorer
- Shuttle Barebone XPC SN78SH7
- How to use Pwnage tool to jailbreak (unlock) iPhone and iPod
- Enable Spellchecking in Firefox 3
Leave a Comment
All contents are licenced under a Creative Commons Licence.


Comments
Windows XP SP3 endless reboot boot (Stop c0000139): Didn’t work for me, I couldn’t get past the...
Fix “Browseui.dll was not found” issue in Windows XP: worked like a charm …recommended.
Windows XP SP3 endless reboot boot (Stop c0000139): Thanks worked for me
Disable Windows Vista and XP from requiring for password on wakeup from Standby or Hibernation : Your blog is...
How to remove Windows Genuine Advantage (WGA) plug-in from Firefox: “If any info related to the plugin...
Windows XP SP3 endless reboot boot (Stop c0000139): No found it via google searching for a problem