
In WordPress, creating a new Widget area means creating an area on the page where you can insert content of various types such as images, text, HTML, etc…
What is a Widget area in WordPress
A Widget area in WordPress is a position of your theme where you can place widgets: small applications that provide extra functionality such as displaying a list of recent posts, social media sidebar, search, etc.
In WordPress, widgets can be placed in different area, such as the sidebar, footer or a new widget area specially created. These positions can be defined by the theme or by a plugin.
Create a new Widget location
Open and edit the wp-content/themes/YOUR_THEME/functions.php file of the WordPress theme, adding the following code:
function create_new_position_widget() {
register_sidebar( array(
'name' => 'New Widget Location',
'id' => 'new_position_widget',
'description' => 'This is the new widget location',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
) );
}
add_action( 'widgets_init', 'create_new_widget_position' );
A new Widget area in Theme
In theme file where to enter new position code enter:
<?php if( is_active_sidebar('new_position_widget') ) { ?>
<div class="new_position_widget">
<?php dynamic_sidebar( 'new_position_widget' ); ?>
</div>
<?php } ?>