Posts Tagged ‘div’

How to add sidebar to single.php (Single Posts) to your wordpress blog default theme

Tuesday, April 12th, 2011

Until recently, I have used a default wordpress theme which historically is a bit old and used to be a default theme to the older versions of wordpress.
Since however, I’ve went to many updates and on the other hand I do like and enjoy the template I have decided to continue use it for my blog until this very day.

However this nice theme’s default behaviour is a bit weird, since by default the Single opened posts are configured in a way that the usual index page sidebar is missing.
As in the sidebar there are plenty of navigation buttons and search in the blog button, at a certain moment I have realized it’s probably not a good idea that the single.php (single blog posts) open up with the right sidebar missing.

Thus I’ve decided to put back the missing sidebar in the single posts, with a hope that this will be helpful to my readers and hence have positive impact on the overall blog user experience.

Doing so prooved to be rather easy, here is how I added back the right sidebar to my wordpress single posts :

1. Edit blog/wp-content/themes/default/single.php

debian:~# vim /var/www/blog/wp-content/themes/default/single.php

2. In the single.php look up for the code:

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

Substitute this html code with:

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

3. Next find the code: <?php get_footer(); ?>

Right before the get_footer(); php function add in the function;

<?php get_sidebar(); ?>

Tadam! Refresh a single post in Firefox and you should see your blog index.php sidebar to show up.