Tutorials

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:-

  • Details-sidebar.php
  • Creation-sidebar.php

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.

<?php

/*

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\’); ?>

In this manner, you can go about giving custom sidebars to custom pages. You can also use plugins to do this task, but of course, you’ll need to go through specific plugin tutorials to be able to use them.

Use Custom Sidebars

Leave a Comment

1 × four =

Hurry Up !!!

BIG Discounts &
Great Savings on

Popular WordPress Themes of Top Developers
GET IT NOW
* Terms & Conditions Apply
close-link