Adding the Wordpress Sidebar to Every Page

When you first install Wordpress, the default Kubrick theme doesn’t display the sidebar when you view a single post. It’s a feature many people ask for and here’s how you do it.

In your Wordpress admin interface, navigate to Presentation > Theme Editor and then select Single Post from the right menu. The ’single.php’ file will appear in the editing window.

The first change is to replace the second line:

<div id="content" class="widecolumn">

with

<div id="content" class="narrowcolumn">

Once that’s done, scroll to the bottom of the page and find the line <?php get_footer(); ?> and replace it with:

  1. <?php
  2. get_sidebar();
  3. get_footer();
  4. ?>

And that’s it! Your sidebar will now appear on every page of your Wordpress blog.

Bookmark and Share

13 Responses to “Adding the Wordpress Sidebar to Every Page”

  1. GlowStormLion Says:

    Adam, you’ve made my day MUCH easier with that bit about narrowcolumn vs widecolumn! Thank you a ton for an easy to read, quick to implement yet super useful post! :) Much love!

  2. Phantom Says:

    Thanks Dude!! PS - really cool blog!!

  3. Kim Says:

    Thank you so much for this! Now teach us how you get those killer designs on the background LOL!!

  4. Adam Owen Says:

    Glad you found it helpful guys!

    Kim - I might just do that! :)

  5. Karen Bryan Says:

    Thank you so much for this simple,clear explanation that even a non techie like me could follow. I’ve been wanting the sidebar to show on all pages/posts for ages and had tried some other ways that I couldn’t get to work

  6. Amy Holding Says:

    Hi Adam,

    Thank you so much for this post. I work as a virtual assistant and have just recently entered this crazy world of CSS/PHP. (Just when I felt like I got the hang of HTML!) This little change worked perfectly and I also applied it to the archives page for a blog I am putting together for a client.

    Thanks again, from my clients as well!

  7. lol Says:

    thanks for the post, really helped me, nice site too

  8. Josh Says:

    Thanks so much, I really appreciate it!

  9. ben Says:

    You can also simply delete the single.php file altogether and WP will use the index.php file instead.

  10. Adam Owen Says:

    Ben: While this is true you will lose comments on your entries, plus many people like to add single.php specific content such as related links etc. which will also be lost.

    Personally I wouldn’t choose to delete the single.php file when a couple of code changes are all you need, even if you don’t allow comments.

  11. Brian Says:

    I’ve just started with WordPress and was trying to figure out for a couple days how to do this. You think it would be the default, or at least an option, inside the dashboard. The WordPress site was not very helpful — you were. Thanks, Adam.

  12. Tug Says:

    Wonderfully easy. Thanks Adam.
    Tug

  13. Srinath Sadda Says:

    Hi,

    Thanks for the tip. Your blog is awesome! Publish more such tricks…

Got something to say?