WordPress Theme Twenty Eleven: Add Sidebar to Single Posts

WordPress Theme Twenty Eleven: Add Sidebar to Single Posts

Problem

The default WordPress Twenty Eleven Theme that I use on this site by default does not have a sidebar on single posts.

The single posts will go from the example of the left to the right example

Solution

Update:

There is a plugin that will do this all for you. Use Twenty Eleven Theme Extensions instead

http://wordpress.org/extend/plugins/twenty-eleven-theme-extensions/installation/

 

You will need to edit two files for the theme. You can do this in two ways:

1. Edit the files directly in

wp-content/themes/twentyeleven

2. Go to the wordPress admin panel under Appearance>Editor option

WordPress Appearance tab

 

Firstly edit single.php

at the bottom of the file change the following


to this instead


Now if you look at a single post you will see the sidebar has appeared but not in line.

Capture2

 

Next you will need to edit functions.php

Go to the bottom on the file and find the following line

add_filter( 'body_class', 'twentyeleven_body_classes' );

Now comment this out

/** add_filter( 'body_class', 'twentyeleven_body_classes' ); */

Now the sidebar will be correctly aligned

single sidebar