WPBeginner

Beginner's Guide for WordPress

  • Blog
    • Beginners Guide
    • News
    • Opinion
    • Showcase
    • Themes
    • Tutorials
    • WordPress Plugins
  • Start Here
  • Deals
  • Glossary
  • Videos
  • Products
X
☰
Beginner's Guide for WordPress / Start your WordPress Blog in minutes
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

WPBeginner» Blog» Themes» How to Hide the Sidebar on Your WordPress Home Page

How to Hide the Sidebar on Your WordPress Home Page

Last updated on June 21st, 2012 by Editorial Staff
3 Shares
Share
Tweet
Share
Special WordPress Hosting offer for WPBeginner Readers
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.

3 Shares
Share
Tweet
Share
Popular on WPBeginner Right Now!
  • Error Establishing a Database Connection in WordPress

    How to Fix the Error Establishing a Database Connection in WordPress

  • Google Analytics in WordPress

    How to Install Google Analytics in WordPress for Beginners

  • Step by Step Guide: How to Start a Podcast with WordPress

    How to Start Your Own Podcast (Step by Step)

  • How to Properly Move Your Blog from WordPress.com to WordPress.org

About the Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Page maintained by Syed Balkhi.

The Ultimate WordPress Toolkit

28 Comments

Leave a Reply
  1. Guenscher says:
    Mar 27, 2017 at 3:58 pm

    I tried it but it not work with twenty sixteen theme

    Reply
  2. F.Munir says:
    Dec 12, 2016 at 2:39 am

    How can we remove the sidebar from a genesis homepage (blog page), using a genesis child theme?

    Reply
  3. Darryl Gebien says:
    May 11, 2016 at 3:33 am

    Confused re: “First open your index.php and locate the following code:”…which “index.php” file? There’s several in my directories in File Manager.

    Hierarchy is:

    Root > Public_html > thebalconycleaners > then which subfolder? (wp-admin vs wp-content vs. wp-includes). My guess is wp-content > themes > twenty sixteen > index.php file, however the code changes didn’t work.

    Which is the correct one to change please?

    Thanks for any help!
    Darryl

    Reply
    • WPBeginner Support says:
      May 11, 2016 at 10:29 pm

      This tutorial is talking about a index.php file in your WordPress theme. You can find your WordPress theme files by connecting to a FTP client and locating /wp-content/themes folder. Inside the themes folder you will find a folder with your current active theme’s name. Open this folder and you should be able to find a index.php file among many others.

      You can also see this file by visiting Appearance » Editor. Look at the list of files on your right and you will see index.php among other files. However, be very careful editing file from WordPress admin area. A tiny little mistake can lock you out of WordPress admin area.

      Reply
      • Darryl Gebien says:
        May 11, 2016 at 11:00 pm

        Thank you for your reply but I double checked using FTP and the Editor you mentioned and confirm the changes are there, but it’s still not working on my homepage.

        Please advise. Ty!

        DG

        Reply
        • Darryl Gebien says:
          May 11, 2016 at 11:07 pm

          I finally did it by removing all widgets from the sidebar using the Customizer. Is this how you recommend?

  4. Mandy says:
    Nov 23, 2015 at 12:46 pm

    Hi, thank you so so so much! I’ve been trying all sorts of codes/css modification for days, and finally came across your page and it works! I have finally removed the sidebar on home page, with other pages unaffected, like I intend them to.

    I do wish the front page content can be expanded to fill out the removed sidebar. Do you have a code that helps?

    Thanks!

    Reply
    • Abbas says:
      Jan 18, 2016 at 3:20 am

      For solving that problem and fill out the removed sidebar, I added this code in “index.php” for changing “width” of the primary content in homepage:

      <div id="primary" class="content-area" >

      In the case of different themes, this style may be different.

      Reply
      • Chay says:
        Sep 10, 2016 at 3:46 pm

        Hi Abbas,

        Where do you add the ?

        I put these code in my page.php, instead of index.php as they are not working on index.php

        Reply
      • Jan C says:
        Feb 16, 2017 at 4:01 pm

        Hey, what exactly did you change in the index.php to fill the removed sidebar with content? I tried to interpret what you were saying here but i can’t seem to get it, because this: “” is already a part of the index file..
        Help would be much appreciated.

        Reply
  5. Livi says:
    Apr 2, 2014 at 9:10 pm

    Visit number three to your site in the last 2 hours. HAD to subscribe. Worked perfectly.

    Reply
  6. Sandeep says:
    Nov 9, 2013 at 2:27 am

    Wow that is just what I was looking for…

    Reply
  7. Zack says:
    Nov 6, 2013 at 3:02 am

    After following your tutorial, the homepage sidebar gone, but the text of post are doesn’t fit to the page. why?

    Reply
    • WPBeginner Support says:
      Nov 6, 2013 at 7:28 pm

      Some WordPress themes can have a <div> or other elements opening in homepage but closing in the sidebar template. Using this code in such a theme could break the layout. You can try to create a custom home page in WordPress.

      Reply
  8. Donna says:
    Sep 8, 2013 at 10:58 pm

    Not sure what I did wrong, but sidebar is still on the homepage

    Reply
  9. Ma Ke says:
    Jun 19, 2013 at 1:38 am

    It doesn’t work in my blog. When I entered the index.php, site stats etc appeared. No codes. Any help?

    Reply
  10. Tomi says:
    Apr 27, 2013 at 12:05 pm

    Thank you very much!!!
    It worked perfect!!!!

    Reply
  11. Scott says:
    Nov 27, 2012 at 2:04 pm

    Thanks! Just what I was looking for, and worked as advertised.

    Reply
  12. Lucas Raby says:
    Sep 21, 2012 at 4:29 am

    What if you want to hide it on the contact page rather than the homepage…? Thanks.

    Reply
    • Editorial Staff says:
      Sep 21, 2012 at 9:15 am

      Then you use one of the available WordPress conditional tags to do so.

      http://codex.wordpress.org/Conditional_Tags

      Reply
  13. Milky Media says:
    Jul 12, 2012 at 7:08 pm

    Just wanted to add on this that I’ve been finding the ‘get_sidebar’ code in the footer.php.

    If you can’t find it in index.php, try there.

    Reply
  14. Junaid says:
    Sep 19, 2010 at 7:25 am

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

    Reply
  15. Geekyard says:
    Sep 12, 2010 at 1:37 am

    Great Hack buddy :) Works fine ;)

    Reply
  16. Dario Gutierrez says:
    Oct 21, 2009 at 2:56 pm

    Great tip dude! Thanks

    Reply
  17. joyoge bookmark says:
    Oct 14, 2009 at 5:03 pm

    thanks for the tip..

    Reply
  18. Alex Duvot says:
    Oct 13, 2009 at 8:37 pm

    thanks for the tip
    going to try this now

    Reply
  19. alaJoAnn says:
    Oct 13, 2009 at 8:09 pm

    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.

    Reply
    • jmw456 says:
      Oct 21, 2011 at 5:52 pm

      Hi

      When I opened up my index.php file, the code didn’t actually have the bit you stated above. It only had the following text. Could you tell me which bit to replace here?

      Reply

Leave a Reply Cancel reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

Over 600,000+ Readers

Get fresh content from WPBeginner

Featured WordPress Plugin
WPForms Logo
WPForms
Drag & Drop WordPress Form Builder Plugin. Learn More »
How to Start a Blog How to Start a Blog
I need help with ...
Starting a
Blog
WordPress
Performance
WordPress
Security
WordPress
SEO
WordPress
Errors
Building an
Online Store
Useful WordPress Guides
    • 7 Best WordPress Backup Plugins Compared (Pros and Cons)
    • How to Fix the Error Establishing a Database Connection in WordPress
    • Why You Need a CDN for your WordPress Blog? [Infographic]
    • 25 Legit Ways to Make Money Online Blogging with WordPress
    • Self Hosted WordPress.org vs. Free WordPress.com [Infograph]
    • Free Recording: WordPress Workshop for Beginners
    • 24 Must Have WordPress Plugins for Business Websites
    • How to Properly Move Your Blog from WordPress.com to WordPress.org
    • 5 Best Contact Form Plugins for WordPress Compared
    • Which is the Best WordPress Popup Plugin? (Comparison)
    • Best WooCommerce Hosting in 2018 (Comparison)
    • How to Fix the Internal Server Error in WordPress
    • How to Install WordPress - Complete WordPress Installation Tutorial
    • Why You Should Start Building an Email List Right Away
    • How to Properly Move WordPress to a New Domain Without Losing SEO
    • How to Choose the Best WordPress Hosting for Your Website
    • How to Choose the Best Blogging Platform (Comparison)
    • WordPress Tutorials - 200+ Step by Step WordPress Tutorials
    • 5 Best WordPress Ecommerce Plugins Compared
    • 5 Best WordPress Membership Plugins (Compared)
    • 7 Best Email Marketing Services for Small Business (2018)
    • Which is the Best WordPress Slider? Performance + Quality Compared
    • The Truth About Shared WordPress Web Hosting
    • When Do You Really Need Managed WordPress Hosting?
    • 5 Best Drag and Drop WordPress Page Builders Compared
    • How to Switch from Blogger to WordPress without Losing Google Rankings
    • How to Properly Switch From Wix to WordPress (Step by Step)
    • How to Properly Move from Weebly to WordPress (Step by Step)
    • Do You Really Need a VPS? Best WordPress VPS Hosting Compared
    • How to Properly Move from Squarespace to WordPress
    • 5 Best VPN Services for WordPress Users (Compared)
    • HostGator Review - An Honest Look at Speed & Uptime (2018)
    • SiteGround Reviews from 1032 Users & Our Experts (2018)
    • Bluehost Review from Real Users + Performance Stats (2018)
    • How Much Does It Really Cost to Build a WordPress Website?
    • How to Start a Podcast with WordPress (Step by Step)
    • How to Choose the Best Domain Name (8 Tips and Tools)
    • How to Setup a Professional Email Address with Google Apps and Gmail
    • How to Install Google Analytics in WordPress for Beginners
    • How to Move WordPress to a New Host or Server With No Downtime
    • Why is WordPress Free? What are the Costs? What is the Catch?
    • How to Make a Website in 2018 – Step by Step Guide
Deals & Coupons (view all)
Elegant Themes
Elegant Themes Deal
Get all 87 amazingly beautiful WordPress themes by Elegant Themes for only $69. That is like $0.79 per theme!
Media Temple
Media Temple Coupon
Get 20% OFF on all Media Temple hosting plans.
Featured In
About WPBeginner®

WPBeginner is a free WordPress resource site for Beginners. WPBeginner was founded in July 2009 by Syed Balkhi. The main goal of this site is to provide quality tips, tricks, hacks, and other WordPress resources that allows WordPress beginners to improve their site(s).

Site Links
  • About Us
  • Contact Us
  • FTC Disclosure
  • Privacy Policy
  • Terms of Service
  • Free Blog Setup
Our Sites
  • OptinMonster
  • MonsterInsights
  • WPForms
  • List25
  • Awesome Motive
  •  

Copyright © 2009 - 2018 WPBeginner LLC. All Rights Reserved. WPBeginner® is a registered trademark.

WordPress hosting by HostGator | WordPress CDN by MaxCDN | WordPress Security by Sucuri.