How to customize WordPress Sidebar?

by Dev Duff on March 28, 2010

Wordpress Sidebar

I have been using WordPress for blogging and publishing content over the web since a long time. There are more than one reasons why I like using WordPress, one reason is that it is extremely easy to customize. I’m writing this WordPress tutorial to enlighten you with a couple of tricks that can be really helpful in customizing your sidebar according to your needs and/or according to different pages on your blog. One thing is for sure, as you read this tutorial, you will be amazed to find there is so much that you can do to customize WordPress blog sidebar for better looks and better navigation.

Lets think about a scenario for a moment. You setup a new WordPress blog, you setup everything according to your needs, but there is something that’s bothering you. Perhaps it is the sidebar, may be you don’t like the sidebar the way it is setup to appear the same on all pages, posts, archives, etc. You feel that you need the sidebar on homepage a little different from the sidebar on article pages. What are you going to do about it? Most of the time, we simply move on and let the sidebar be same through out the blog.

Before we go discussing how to overcome this obstacle and do something about it, let me tell you why you should have a different sidebar for home page than the sidebar on article pages/posts. These are the reasons why I would wish to customize the WordPress sidebar according to my needs:

  • Normally, article pages are longer than the homepage. On article pages, you have more room for advertisements and widgets in the sidebar. And if you fill up the sidebar with lots of widgets and ads, your homepage is going to look “not so good”.
  • Similarly, I wouldn’t really want to fill my blog’s homepage with too many advertisements, widgets, etc. So if I limit the number of objects in the sidebar, I will have to live with the same settings on article pages too. But hay, I need money. So I need adverts.
  • Think about having too many advertisements in sidebar on your blog’s homepage. Having too many adverts on the homepage “may” affect your blog’s ranking on search engines.

Alright, let’s discuss what we can do to overcome this limitation of WordPress. What we need to do, create a copy of the sidebar file. If you look inside your theme folder (YourBlog.com/wp-content/themes/themefolder), you will find the sidebar.php file. Download it on your computer using FTP and then simply create a copy of it. Name it anything, if you are using this new sidebar file for homepage, you can rename it to sidebarhome.php or sidebar_home.php. Upload this file through FTP to your theme folder. Now you have two different sidebar files, one for home page of your blog and the other one can be used for article pages, normal pages and/or archives. You can setup more sidebar files according to your needs for different sections of your blog.

The second step is to link these sidebar files to specific theme files. Open your theme index.php file in the WordPress Admin Panel editor. Then go to the bottom of the page. You will see the link to sidebar.php file in it, just rename it to sidebarhome.php or sidebar_home.php (whatever you named the new sidebar file for your home page). That’s it! Now you can customize these sidebar files separately. Include lesser items for your blog’s homepage sidebar and include more items in sidebar file for other pages.

I hope this WordPress tutorial was helpful for many of you WordPress lovers. If you have any tips or tricks to share, please do so by leaving a comment below. If you loved this tutorial, please consider sharing it with your friends and family. Also, I’m always enthusiastic to know you, please consider saying Hello by leaving a comment below.

This post was written by...

– who has written 305 posts on Dev Duff.

Contact the author

{ 9 comments… read them below or add one }

Jennifer

Hello!

Reply

Dev Duff

Hello Jennifer :)

Reply

Arnold

Good trick! Your wordpress tutorials are easy to understand. Thanks for sharing these tips and tricks.

Reply

steve

Where is the theme folder found?

Reply

Dev Duff

Hello Steve,

Your “theme folder” is located in the themes folder. Login to your site through FTP and follow this path…

Blog Root (public_html) > wp-content > themes > themefolder

That’s where you will find the theme folder. I guess you are new to Wordpress blogging software. All the best!

Reply

Milhealth (Karen)

Hi Dev Duff, thanks so much for sharing your experience. Your tutorials are ‘easy to use’ (short) helpful screenshots, and great explain./reasoning behind the ‘action’. I’ve been looking quite some time for an easy to understand expl on this (widgets/sidebar). Even though I have decent wp skills, just couldn’t ‘get’ others. Now, going to try it out. I’ll be sure to share your site w/others!
k

Reply

Mike

You can also use The Graceful Sidebar Plugin. This easy to use plugin lets you put custom content in the sidebar area for each post or page.

Enjoy!
Mike

Reply

Anuj

Hi,
Indeed these are all great things to do to your blog. I have recently started my blog and have learnt a lot over the last couple of months. There is so much more to learn still. Thanks for the info.

Reply

Subodh Gupta@blog setup

Thanks for sharing the easy-to-follow tutorial! some plugins (for eg widget context) could be useful to display selected items on sidebar of specific pages.

Reply

Leave a Comment

Previous post:

Next post: