Adsense is great source of income for many bloggers. It’s most important how you place these ads with maximum visibility to your viewers. You will get many options to set your ads in different sections of your blog page but what ‘s most themes do,is give you a customized section where you can place ads. Sometimes with your blog style and architecture it won’t be an adequate and accurate area to display your ads. This is when editing of your blog page is important. This post explains you how to do this in a simple and easy way. This post helps you to display adsense ads on the first main page that is the index page.
Index page of the blog is the first page which is displayed when ever somebody types in your blog URL like www.techdunes.com . It’s important that you add your adsense ads on this page because this is your main landing page where you get most number of visits.
How to display adsense ads on first page between first and second post. (See this example: www.techdunes.com )
1) First is to login to your WordPress, login with the admin rights (as admin).
2) In the main dash board on the left side bit down you will find Appearance – Editor.
3) Click on the editor.On left side you will see Main Index Template (Index.php).click that.
4) You will see your index page php code in the text box. Now find out the php code as here, <?php if (have_posts()) : while (have_posts()) : , use CTRL + F button to search for it.
5) Once you find this code area, just above the top code add <?php $bscount = 1; ?>
6) Now it your code will look like this:
<?php $bscount = 1; ?>
<?php if (have_posts()) : while (have_posts()) : ——————-
7) Now after this look for (use CTRL + F) code <?php endwhile; else: ?> and just above this code add this <?php $bscount++; ?>
8) So your code at end look like this :
<?php $bscount++; ?>
<?php endwhile; else: ?>
9) After you have done this place this code between these codes which is mentioned above.
<?php if ($bscount == 1) : ?>
Place your adsense code
<?php endif; $bscount++; ?>
10) That’s it this will place adsense on the first page of your WordPress as in my blog.
Note:
- You are messing with the main page of your WordPress blog so before doing any changes in the code ,copy paste the original code to a notepad and save it, so that if you do anything wrong you can save back to original code. It’s important.
- You need to make your index.php writeable to edit this in your WordPress; this may be not your default settings so you will have manually change this so that it can be updated. More information can be found here: http://codex.wordpress.org/Changing_File_Permissions. it’s not a big deal and you can do it very easily.
- Never place more than 3 ad units of adsense in your page (single page).It’s against the adsense TOS.
Subscribe To Get FREE Tutorials!
Renjith
Aug 14. 2010
Informative. Thanks for writing such a nice and easy understadable article on adsense.
admin
Aug 14. 2010
welcome