How to Hide the Sidebar on Your WordPress Home Page

Posted on October 13th, 2009 by in Themes | 8 Comments  
How to Hide the Sidebar on Your WordPress Home Page

As you probably have noticed that most WordPress blogs have the same sidebar on all blog pages. While sidebar is important, sometimes it is not necessary for the homepage. In this article, we will share how you can hide the sidebar on your WordPress homepage.

One of the ways to do is by creating a completely new custom homepage for your WordPress blog, or you can simply make the change by using the code from this tutorial.

First open your index.php and locate the following code:

<?php get_sidebar(); ?>

Then Replace the code with:

<?php if (!is_front_page()) {
get_sidebar();
} ?>

And thats it. Now your Front Page will not have the sidebar.

About

Editorial Staff at WPBeginner mainly Syed and David.

Post comment as twitter logo facebook logo
Sort: Newest | Oldest

Nice and simple hack! Saved me some other theme modification that i feared would mess up things :)

Great Hack buddy :) Works fine ;)

Great tip dude! Thanks

thanks for the tip..

thanks for the tip
going to try this now

Your instructions are a timely find. I just set up a static homepage and figured out how to remove the first code (and things looked right).

Now I have pasted in the replacement code. I'm not a coder, but I bet doing that will avoid problems down the road.

I shared this fix with my fellow PrimePress theme users at our support forum.

Tweets about us: