About Widgets:
WordPress widgets are plug-able items that enhance the features of a site. One can think of wordpress widget as a cassette that needs to be inserted into an available slot so that it performs it’s functions accordingly. Here slot refers to the the widgetized areas that are available according to the nature of the wordpress theme being used.
Different themes have different widget areas , for instance a theme might support a widget in the header section, or a sidebar of the theme or maybe in the footer area of the theme. Most commonly, themes contain widget slots for the sidebars but wordpress provides with flexibility to custom integrate a widget slot anywhere in the theme, having said that, a bit of advanced knowledge is required to accomplish the required outcome.
How to enable widget area in wordpress theme
if (function_exists('register_sidebar')) { register_sidebar(array( 'name' => 'Haneef Widgets', 'id' => 'sidebar-widgets', 'description' => 'Widget Area', 'before_widget' => '<div id="one">', 'after_widget' => '</div>', 'before_title' => '<h2>', 'after_title' => '</h2>' )); }
How to add widget area in wordpress theme
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Haneef Widgets') ) : ?> <?php endif; ?>
NOTE: If you want more then one area to be widgetized at the same time, then you have to register sidebar in function.php more then once with different names and id’s
Now that you have enabled the widget area as well as created a slot for the widgets to be placed in, you can go to Appearance -> Widgets in admin panel and add the widgets to the slot you have just created..