Hide Sidebar on Posts: How To do This on WordPress

Steven14 responsesWordPress
Advertise Here

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 post pages.

To hide your sidebar on your blog post pages, edit the single.php file from your theme (if your theme doesn’t include this file, edit the index.php file) and look for the following snippet of code:

<?php get_sidebar(); ?>

and replace it with:

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

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

Learn how I made $36,482 online in the past 12 months.

Simply input your best email below to get started.

Advertise Here


  1. Liz

    Cool new trick, I like it! Thanks again!

    1. You’re welcome ;)

  2. Jony

    If I try this and I don’t like how it looks is it easy to undo?

    1. Mitch

      Of course, you just go back and erase what you put in. It’s very simple and definitely worth a try!

  3. Chris

    Thanks for sharing your sweet new moves with us, I feel like we’re sharing cheat codes hahaha!

    1. Shad

      I always think the exact same thing haha! Gamers unite!

    2. I’m always glad if these tricks can help!

  4. Buysellwordpress

    Excellent and simple feat)) Thanks a lot for it!)

  5. Sarah

    Little off topic, but I LOVE what you’ve done with the place! Looks super fancy and high-tech, you can tell you’ve really thought this out. I hope it brings you much success in this new year!

    1. Thanks for the kind words :)

  6. Dana

    Interesting! I wonder if this is something that will please readers more… I guess it couldn’t hurt to try it! Thanks again for sharing, and love the new layout!

  7. John

    Definitely going to try this one out, seems simple enough but very cool…

  8. Angela

    That’s great thanks. Now how do I fill out the page so the content doesn’t look squashed to the left?

    1. You need to edit the HTML and the CSS to make the div centered.

Learn how I made $36,482 online in the past 12 months.

Simply input your best email below to get started.

No thanks, I have enough money