I want to create a new placeholder / area for widgets in Wordpress admin panel.
Please have a look in screenshot i provided below for better understanding.
As you see there are total 3 place holders for widgets. I want to add more custom placeholders like 4th, 5th..
Also I want to add the placeholder in my theme to display widgets.
For example i created new 4th place holder in admin panel. And there are total 2 widgets in that placeholder. And i want to display all of widgets of 4th placeholder in them with its order.
Widget areas can be added by using the register_sidebar
function:
add_action( 'widgets_init', 'so16750248_register_sidebar' );
function so16750248_register_sidebar(){
register_sidebar( array(
'name' => __( 'Another Sidebar' ),
'id' => 'another-sidebar',
'description' => __( 'Some widgets here.', 'my_textdomain' ),
'before_title' => '<h1>',
'after_title' => '</h1>'
) );
}
To call the widget area in a template, use dynamic_sidebar
:
dynamic_sidebar( 'another-sidebar' );