Blogging

Make Sidebar – Wordpress template



I will tell you how you can add a side bar to the wordpress template.I hope you are familiar with wordpress template editing.You may be having 1 or 2 side bars in your template on which you can add widgets from Appearance>Widgets  .Suppose if you want to add a new side bar for your particular page say the page in which your singe post is displayed,here is the method

If your theme has only one sidebar, then most probably you will NOT find a file called functions.phpin your theme folder. In that case you will have to create this file yourself. Just open notepad or any other code editor to start a new file. Put this code into that file :-

 

 

<?php
if ( function_exists('register_sidebars') )
register_sidebars(2);
?>

Save the file.

Note : The code may differ depending on your theme…Just go through function.php and find out how side bar is added there and copy the same steps to add new side bar.

 

Now you can see your new side bar on the dropdown box  in Appearance>Widgets

Now i will tell you how you can use this side bar in your page

Make a new file in the template directory named sidebar1.php

Add this code to the file

<div>
<ul>
<?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(2) ) : else : ?>
<?php endif; ?>
</ul>
</div>

Now you can use the side bar in any page using the code below

<?php include (TEMPLATEPATH . '/sidebar.php'); ?>

No related posts.

Thanks for reading my blog. If you like what I write, why not subscribe to my feed?

If you are busy, I can send the latest post to your email. Just subscribe to my email updates.

 

Enter your email address:

Delivered by FeedBurner

Discussion

No comments for “Make Sidebar – Wordpress template”

Post a comment