Dukeo » WordPress » Hide Sidebar on Homepage: How To do This on WordPress

Hide Sidebar on Homepage: How To do This on WordPress

Steven 5 responses WordPress

Your WordPress blog sidebar is an essential element of your blog, however, on some occasions you might not want it to be displayed on your blog homepage.

To hide your sidebar on your homepage, edit the index.php file from your theme and look for the following snippet of code:

<?php get_sidebar(); ?>

and replace it with:

<?php if(!is_home()) {
} ?>

You’re done! Your sidebar will be displayed on all your blog pages except your blog homepage.

If you enjoyed this article,
Get email updates

Join for Free »


  1. Thanks for this usefull info :) i’ll try it

  2. Affiliate Manager

    Very cool. Do you think there’s any value added SEO wise by not displaying all the same links in your sidebar on ALL of your pages? Your homepage is likely to be your most popular page. Wouldn’t you want those internal links there? :)

    1. It really depends on your goals with your blog… By removing the sidebar from the homepage, you can have a very clean single column layout which could be a sales letter or a pitch to get people to subscribe. In that case, I’m not thinking about SEO, but definitely about capturing reader’s data.

    2. Affiliate Manager

      True, definitely would get rid of the distraction. I actually did the same thing on my “Join PeerFly” page on LukePeerFly.com and it works well. lol

  3. David

    when I first started with wordpress, I had to do just the opposite, I think it was pages or archives or something. And I had to add the code to get the sidebar to show.

    Good tutorial and helpful to those who are beginning to work with wordpress.