• Home
  • New Entries
  • Popular Entries
  • Submit a Story
  • About

How to Add Adsense Ad Unit Only After First Post in WordPress Blog ...

I always wanted to show an Adsense ad unit below the first post in my blogs. I only show summaries of posts on the home page in order to prevent duplicate content issue. So I thought that showing an ad unit below the first post’s summary will be good.

I tried to find a solution but I wasn’t very lucky. I tried few WordPress plugins but failed to find what I was looking for. Then I searched the internet for any possible solution. I finally got my answer after few hours of search on the internet.

Here is what you need to do in order to display an ad unit on your home page after only the first post.

Open [you can use any software like dreamweaver] the Index.php page of the theme that you are using [download it from your server if you don have it in your PC].

Now look for this function in the index.php file

    the_excerpt

Or this function

    the_content

The first function, which is [the_excerpt], is used if you want to show only summary of posts on your blog’s home page.

Where the function, the_content, is used if all the content of the post is displayed on the home page.

Below the line where this function ends, you will have to add this code.

    <?php if(is_home() && $post==$posts[0] && !is_paged()) { ?>

    Put Adsense Ad Code Here

    <?php } ?>

Save the file and then upload it. You will now see an ad unit below the first post [only] on our home page.

 Original Source:
http://a1newspapers.com

AddThis Social Bookmark Button

Posted at 11:17:57 am | Permalink | Posted in Adsense  How to Blog  Wordpress Tips  

Related Stuff

Google Buzz Button Wordpress Plugin Released

If you are looking for a Google Buzz button to add into your Wordpress site then we have released the first Wordpress plugin exclusively ...

Plug And Play Ecommerce With Wordpress Plugins

Since 2003 Wordpress has slowly been gaining popularity amongst the elite of the internet, the bloggers. It is one of those few things ...

Add Google Search to Your WordPress Blog

The native WordPress search does not return very relevant results, thus it makes a lot of sense to add Google Search into your WordPress ...

Add More Sidebars to Your WordPress Theme

You can add more than one sidebar section to your WordPress site. For example, with the stc-intermountain.org site, I added a whole bunch ...

Series Posting in Wordpress

In my functions.php file, I have some code which implements series posting. This relies on the thematic ...

Top Stuff

Free Blogger templates Anime Themes

Wordpress Guestbook Generator Plugin

48 Unique Ways To Use WordPress

GeekLog

WordPress Single Post Templates

Get The Image WordPress Plugin


Meebo

Meebo, an ajax-rich web-based instant messenger application.


About Webloglines

Webloglines is a project offers a comprehensive collection of blogging services, articles, themes and plugins from around the world. Whether you're looking to promote your own blog or find blogs on various topics, this site is for you.


Search


Topics

  • Adsense (12)
  • Blogging Tips (73)
  • Blogs Slides (25)
  • Blogs Websites (22)
  • Digg (20)
  • How to Blog (129)
  • Search Engines (9)
  • SEO (135)
  • WordPress Plugins (269)
  • WordPress Security (75)
  • Wordpress Themes (99)
  • Wordpress Tips (162)

© 2006 www.webloglines.com. All Rights Reserved. Powered by IRange