Adding Widget in your theme
Step 1. Add the following code in functions.php to enable/register widget area in the WordPress theme:
if (function_exists('register_sidebar')) { register_sidebar(array( 'name' => 'Sidebar Widgets', 'id' => 'sidebar-widgets', 'description' => 'Widget Area', 'before_widget' => '<div id="one" class="two">', 'after_widget' => '</div>', 'before_title' => '<h2>', 'after_title' => '</h2>' )); }Step 2. Add the following code to the area ( sidebar, footer, header ) where you want the widget to to make a slot and add widget to it later from widgets setting panel:
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Sidebar Widgets') ) : ?> <?php endif; ?>