How to add a dynamic sidebar in WordPress?
Do you ever wonder that you have one sidebar, but you want to display widgets in other places, and they don’t come in with manual codes that you can enter in the page and avoid using the widgets. Well there are some widgets that doesn’t have the manual tags. The solution to those is to add more than one dynamic sidebar in wordpress and display them where you want. I like this because I can manage everything from my wordpress admin panel and have everything where I want on the template. Kill two birds with one stone.
I have made a detailed video, which I will recommend you to watch because that will make the steps much more understandable, but I think you need to visit here to actually get the codes because it might not be as clear in the video.
First of all, Open your functions.php which is located in the themes folder.
[raw]
<?php
if ( function_exists(‘register_sidebars’) )
register_sidebar();
?>
[/raw]
By default it shows something like I have put above. Replace these codes with the ones below:
[raw]
<?php
if ( function_exists(‘register_sidebars’) )
register_sidebar(’2′);
register_sidebar(’3′);
register_sidebar(’4′);
?>
[/raw]
You can add the numbers as you go. Remember you start with 2 because sidebar 1 is already defined.
Now is the part where you need to see the video because that explains better with live tutorial.
You go to the admin panel, and get to the widgets page, and you will see more than one sidebar there. Upload the widgets in the desired sidebar. Say you want to display the mybloglog recent visitor widget in the footer. You copy that widget in your sidebar 2 or whichever one.
Than open the file where you want to display the codes. In our case footer.php
[raw]
<?php if ( function_exists(‘dynamic_sidebar’) && dynamic_sidebar(2) ) : else : ?>
<?php endif; ?>
[/raw]
Add the codes above, and make sure you change the sidebar number.
This should do it. Enjoy your dynamic sidebar. This will make your life so much comfortable now because you can edit settings through the admin panel rather than editing each plugin file individually.
















Hey, I am Syed Balkhi, The guy who is behind Balkhis Inc. I entered the industry back in 2002 not knowing a single thing. I barely spoke English at that time. In the past six years, my language barrier has been eliminated. Aside from English, now I also speak html, and php. Along with the languages I have also managed to master a few arts. Art of web-designing started when I first entered. Messing around with photoshop, I learned how to create my first web design. Now I founded a web designing firm Uzzz Productions. After running numerous amount of websites in various niche, I have mastered the art of web-development. Now I am compiling a resource of what I already know, and what I am learning on this blog. This resource is to help me if I ever need a guide to look back to, and it is help my fellow webmasters.



