Hi Friends !! I am back in blogging after long time. Are you looking for adding new widget in wordpress ? I had this requirement few days ago and I found a solution for this. I have done some custom code in wordpress and I got my solution.
Do you want to add different widget for different template page ? Are you finding about how to show dynamic widget in template ?
Then your search end here. I will show you today that how you can add new widget and how you can call it in template.
First find functions.php in your theme folder. If not then create functions.php. Then add below code in that file :
'name' => __( 'Test Sidebar', 'twentyeleven' ),
'id' => 'sidebar-6',
After adding this in your function.php, in admin, you can see one sidebar block in widget.
Now How to show this particular sidebar in template ? Its also an easy task. Open template file (you can also put this in page.php).
And place below code in at location where you want to show that widget:
<?php if ( is_active_sidebar( 'sidebar-6' ) ) : ?>
<div id="first" class="widget-area" role="complementary">
<?php dynamic_sidebar( 'sidebar-6' ); ?>
<?php endif; ?>
Thats it !! You can add as many widgets as you want in your site. You can make unique look.
If you have any doubt or any query then comment on this or you can directly contact me via contact form.