Posted on Leave a comment

How to create custom widget Area in the admin Widgets page?

To create custom widget area we will need functions.php file (should be in the root directory of the theme) to add some custom code. We use wordpress filter “widgets_init”.

<?php
function register_my_sidebar()
{

  $args = array(
	'name'          => __( 'Footer 1', 'theme_text_domain' ),
	'id'            => 'footer-widget-1',
	'description'   => '',
        'class'         => '',
	'before_widget' => '<li id="%1$s" class="widget %2$s">',
	'after_widget'  => '</li>',
	'before_title'  => '<h2 class="widgettitle">',
	'after_title'   => '</h2>' ); 
    register_sidebar( $args );
}

add_filter('widgets_init', 'register_my_sidebar');


?>

You can copy paste this code in your functions.php file to see results.

Result will look like in the screenshot below ( Inside the admin panel > Appearance > Widgets ):

Screenshot_1