Adding a Sidebar to WordPress Default Theme
I have a personal blog I play with at SuzCorner.com, which uses a color-altered version of the WordPress Default Theme (what can I say, I like it
). But a big source of frustration for me has been how the navigation sidebar simply …evaporates… when you go to a single archived article. Why? What possible point does it serve to make the navigation go away? I even spent quite a bit of time modifying the BlueBerry theme (a colorful variation of the Default theme) to the precise color scheme I wanted, only to find that, unlike the author’s own site which happily carried the navigation from page to page, when it came to be applied to my site, the navigation sidebar would just disappear again!! (Please excuse the language, but … WTH???)
A few times in months past, I’ve tried talking to other theme authors about different anomalous behaviours, only to get back a lot of head scratching and pretending to not know what I was talking about. So maybe it wasn’t fair this time, but I didn’t even bother writing to the authors of either Default or BlueBerry. I just started Googling, er, um, Binging “How to add a sidebar to WordPress Default theme”, and found this page.
It’s a pretty nice informative page, and if you scroll way way down, it even gives a mention to adding a sidebar to the single archived pages of a Default themed blog (my case). You just edit the ‘single.php’ file, and stick in a <?php get_sidebar (); ?> statement.
Got that?
No hint, though, about where in the file to put it!! (Nice.)
That part I had to figure out myself, and now I’m telling you — But before adding the new statement to call up the sidebar, you have to make room for it. The content of those single archived pages has been made wide to fill the space the sidebar used to occupy, so you have to make it narrow again.
In the ‘single.php’ file, find the line near the top that says:
<div id=”content” class=”widecolumn”>
Change it to:
<div id=”content” class=”narrowcolumn”>
Now you can scroll all the way down to the bottom, and find the very last line, which says:
<?php get_footer(); ?>
Just before that line, insert the line that says:
<?php get_sidebar (); ?>
So what you end up with in the last two lines of the file ‘single.php’ is:
<?php get_sidebar (); ?>
<?php get_footer(); ?>
Voila!
Why go to all that trouble you say? Well, so your visitors will never get confused! People who run out of things to read and click on on a web site (like navigation) soon leave and take their business elsewhere. And that’s not what you want for your web site, is it?













