WordPress tutorial for, In this article we will show, how to Create multiple widgets in wordpress theme. Widgets for very important in wordpress themes and plugins. First I need to tell you this widget api is located in following file.
For enable the sidebar support in wordpress theme you need to register atleast one sidebar in wordpress api. For enabling the side bar you need to just open the functions.php file and put following code in that file.
if ( function_exists('register_sidebar') )
This is enable the global sidebar for your wordpress theme.
If you want multiple sidebar in your wordpress theme then use the following code. I created two sidebars in my wordpress theme. First is normal sidebar and second is footer sidebar.
For main sidebar showing just open your sidebar.php file put following code in that file.
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Main Sidebar') ) :
For showing second widget in footer section open your footer.php file and put following code in that file.
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Footer Sidebar') ) :
Then go to your widget section through admin panel and select your widget which you want to show in widget sections.
Create multiple widgets in wordpress theme
If you are having any issues or question about using widget in wordpress theme then write to me.