How To Display Ads On Homepage Only In WordPress

by Abi on May 15, 2009

At the other day I got a request from one of my Advertisers, he said it’s possible for it’s text link to only appear to homepage only, not in other sub pages, I told him yes sure it’s possible. Thus I make this post as tutorial to ones seek for displaying Ads on homepage only.

What you need to do now tell WordPress to only display the Ads on homepage only, and hide it in other pages, to get this one work we need to add additional code inside the loop in our index.php page:

<?php if(is_home() && $post==$posts[0] && !is_paged()) { ?>
Put Your Ads code here
<?php } ?>

(Put the theme anywhere in your theme)

This code will make your Ads to display on Homepage only and not on archive, category, page or single pages. See you in the next post.

Related posts:

  1. Adorn 404 Page In WordPress To Retains Visitor From Leaving Our Blog
  2. How To Make WordPress Theme SEO Friendly Theme
  3. How To Get Back WordPress Widgets That Disappeared
  4. Split WordPress Page Into 2 Pages
  5. SEO Your WordPress Description And Keyword Without Plugins

{ 1 comment }

Signupandmakemoney May 16, 2009 at 2:53 pm

Thanks for the informative post. I’m going to try out the code on my wp blog as soon as I can.

Comments on this entry are closed.

{ 1 trackback }

Previous post:

Next post: