How to make a custom widget area in wordpress?

custom widget area in wordpress

custom widget area in wordpress

Amitpal Singh
First of all place this code in function.php file to register a widget. Make sure that this widget name is unique and different for each.

if (function_exists(‘register_sidebar’)) {
‘name’ => ‘Extra Widgets’,
‘id’ => ‘extra-widgets’,
‘description’ => ‘The extra widgets for your website.’,
‘before_widget’ => ‘<div id="%1$s" class="widget %2$s">’,
‘after_widget’ => ‘</div>’,
‘before_title’ => ‘<h2>’,
‘after_title’ => ‘</h2>’

after this, You can place this below code where you want to show the widget content:

if (!function_exists(‘dynamic_sidebar’) || !dynamic_sidebar(‘Extra Widgets’)) :
endif; ?>


Leave a comment

Your email address will not be published. Required fields are marked *