How To Add Sidebar To Single Post Page In WordPress Twenty Eleven?

Spread the love

I am running my blog in WordPress 3.2 Twenty Eleven Theme.But before today i was not aware how to add sidebar to single post page in WordPress 3.2 Twenty Eleven theme.It was annoying for me because my readers were not able to get the view of my sidebar when they navigate to a single page.This was still tolerable because there were not much important thing in my sidebar of the home page.But the problem becomes severe when i was about to integrate Google Adsense to my webpage.

Add_sidebar_to_single_page

A

I was about to integrate one “wide skyscraper” in my homepage but in the very next minute i thought that when readers will go to the single post page they will not be able to see that Google Adsense.So, there is no point to place that Google ad on the homepage.

Also see : How to change footer text in WordPress Twenty Eleven Theme?

But it was just an adjustment for me.I was actually wishing to add that ad unit in my homepage and i want that to be visible in every page in the blog.Then i searched for some material but did not get any suitable solution.But at the end a suitable solution is been found and i am grateful to that blogger who pointed out the thing for me.Now i am ok with my sidebar in single post pages.

To make the sidebar visible to single post page you need to follow the below steps and then you will be able to show your sidebar next to your post.All the sidebar materials will be visible just like the home page.So, please follow the steps below:

1. Log in to your wordpress admin panel and then go to Apperance> Editor and then go to the single.php file and click on it.

2.After clicking on single.php file you need to search for

 </div><!– #primary –>

<?php get_footer(); ?>

If you are unable to find it by searching with you eyes then take the help of CTRL+F and then search for it.Then replace it with below:(Please make sure you have copied the original code to a word file or notepad file for backup.It anything goes wrong then this will be your backup!)

</div><!– #primary –>

<?php get_sidebar(); ?>
<?php get_footer(); ?>

3.Now you need to update file.Still your work is not done completely.Now if you click on a single post and go to a single post page you will see the sidebar is visible in that page but it is showing in the bottom of the page.So, you need to adjust it.So, let’s go to the next step to adjust it:

4.Now you need to go to the functions.php file in the editor and click on it.Then you need to search for the ‘singular’ option which you will find in the bottom of the functions.php file.Then you will see one line:

add_filter( ‘body_class’, ‘twentyeleven_body_classes’ );

You need to make this line like below:

/**
*add_filter( ‘body_class’, ‘twentyeleven_body_classes’ );
*/

Here in the above line you can see that the added terms are /** and */

5. Now click update and you are done!

This is a quick way which you can do to fix the sidebar in single post page without any deep HTML knowledge.Hope this will help you to redesign you template.

Himadri Subrah Saha

Himadri is an ICT Professional who writes for his technology tips & tricks related blog TechnTechie. Though it is hard to balance time in between professional life and blogging, he still manages time to work for his own blog and writes almost regularly. The dashboard of this WordPress is the only place where he does not feel tired! Read my other blogs @ PetCare and Teleinfo

0 0 votes
Article Rating

Subscribe
Notify of
guest

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
S. Ray
S. Ray
10 years ago

Many thanks! Your post proved to be very helpful.

S. Ray

1
0
Would love your thoughts, please comment.x
()
x