Widgets are the most common part used in WordPress. Adding multiple widgets WordPress is must have requirement if you are developing a website for someone so they can manage the content from admin under widget section.
In the previous tutorial, I have explained you how to add widgets to the page. In that we had added a single widget. If you don’t know how to add single widget, you can refer to this link. If you are done with that then follow these steps:
Step 1:
As we have done with adding the following code in our function.php file:
function arphabet_widgets_init() {
register_sidebar( array(
'name' => 'footer',
'id' => 'search',
'before_widget' => '<div>',
'after_widget' => '</div>',
'before_title' => '<h2 class=â€roundedâ€>',
'after_title' => '</h2>',
));
}
add_action( 'widgets_init', 'arphabet_widgets_init' );
Inside this file, add another code as given bellow:
register_sidebar(array( 'name' => 'footer1', 'id' => 'subscribe', 'before_widget' => '<div>', 'after_widget' => '</div>', 'before_title' => '<h2 class="rounded">', 'after_title' => '</h2>', ));
Your final code will be:
function arphabet_widgets_init() {
register_sidebar( array(
'name' => 'footer',
'id' => 'search',
'before_widget' => '<div>',
'after_widget' => '</div>',
'before_title' => '<h2 class="rounded">',
'after_title' => '</h2>',
));
register_sidebar( array(
'name' => 'footer1',
'id' => 'subscribe',
'before_widget' => '<div>',
'after_widget' => '</div>',
'before_title' => '<h2 class="rounded">',
'after_title' => '</h2>',
));
}
add_action( 'widgets_init', 'arphabet_widgets_init' );