Subscribe today to our RSS feed for free or enter your e-mail address to get daily tips delivered to your inbox:

Hide and Show Content in WordPress

Here is a handy WordPress theming tip that I have been using for some time now on my web sites. Have a block of text that you would only like to have shown on the main web page index?

Here is the code you’ll want to use:

<?php if ( is_home() || is_page() ) { ?>content only shown on your index page<?php }?>

Replace content only shown on your index page with your own content and then paste that into your WordPress template file. Here are a few more resources to help you out if you want to go a little further with this.

Now where would this come in handy? Well I use it to hide my links and long Google AdSense ad from all places but the index in my sidebar. It might also be useful if you wanted to display a greeting at the top of your web site or blog and only show that greeting on the index page. Truth be told, your imagination is the only limit with this tweak.

| More

  • Not sure Pinny, but I'll have a look and see. :)
  • Hey Mitch,

    Great tip. Do you have a tip for displaying different information for a first time and repeat visitor in wordpress?
blog comments powered by Disqus

Related Tech Tips and Tricks

Home Page Control
Using WordPress for Static Web Sites
I like to tinker and play with scripts and services Online. When it comes to doing this with Web sites, my best friend at the moment is WordPress. That wonderful little CMS can be used to create just

WordPress
By far, if you want the most bang for your buck, WordPress is the hottest blogging script out there today.  I have spent the past few weeks looking at a lot of WordPress alternatives, but when push comes to shove

WordPress Recipes
It isn’t often that I write up a post to highlight somebody else’s post – but this one is so great I had to share.  This list of over twenty WordPress recipes is a collection of code that anybody who

Mitch Keeler © 2009 - Sitemap | Privacy Policy
Dedicated Server Hosting provided by Layered Tech

Go to Top of Page