Get my FREE ebook:
"SEO FOR BLOGS: The Ultimate Guide"
Limited Time Offer!

How To Hide Your WordPress Blog Sidebar On Post Pages

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:

1
<?php get_sidebar(); ?>

and replace it with:

1
2
3
4
5
<?php if(!is_single()) {
	get_sidebar();
} ?>

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

Commenting Contest
If you enjoyed this article, Get email updates
(It's Free)
Sté Kerwer
Post written by: Sté Kerwer
Bonjour from France. My name is Stéphane Kerwer and Dukeo.com is my blog. I do most of the heavy lifting in here but from time to time, you may see some guest posts. If you wish to receive updates about Dukeo, subscribe to RSS Feed, follow Dukeo on twitter or become a fan on Facebook.
12 Comments
  1. Liz
    Liz

    Cool new trick, I like it! Thanks again!

  2. Jony
    Jony

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

    • Mitch
      Mitch

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

  3. Chris
    Chris

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

    • Shad
      Shad

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

    • I’m always glad if these tricks can help!

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

  5. Sarah
    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!

  6. Dana
    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
    John

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

arrow