How to Use Custom Sidebars WordPress
Customized sidebars definitely add some life to your WordPress website’s pages. If you happen to be the demanding blogger who would not mind to travel the extra mile to get the perfect presentation for his/her WordPress project, this tutorial will be of great help as it tells you how to add customized sidebars to WordPress webpages.
You will need to begin by creating separate page templates for every custom sidebar you want to be functional on your website. Once you are done with this part of the job, you have to proceed to the second step, which is to create customized sidebar templates. The best practice here is to name them in a manner that allows you to remember their style and contents.
Let us take an example here. Assume that you have created a couple of sidebars, without counting the default sidebar, in the form of sidebar.php. These are:-
Now, you need to create a couple of pages to get these custom sidebars on them. These pages do not need to be different from each other, apart from the call to the intended sidebar. However, other changes, if desired, can be made. The custom page code, which has been given below, has to be used at the top of each page. Here is the code.
Template Name: Custom Page Name
Now, for every custom page template, you need to locate this code.
<?php get_sidebar(); ?>
This code needs to be replaced with the following, where custom-sidebar.php is to be replaced with the name of the created sidebar.
<?php include (TEMPLATEPATH . \’/custom-sidebar.php\’); ?>