Register a sidebar in wordpress

In functions.php add below code

<?php register_sidebar(array(

‘name’ => ‘Right Sidebar’, // name of sidebar

‘id’            => ‘rightsidebar’,

‘before_widget’ => ‘<li>’, // style tag before this element

‘after_widget’ => ‘</li>’,

‘before_title’ => ‘<h2 class=”widgetTitle”>’,  // Title class , you can avoid these fields if you never want to be

‘after_title’ => ‘</h2>’,

));  ?>


You can see the registered sidebar in Appearance >> widget section.

Calling the registered sidebar using id:

<?php dynamic_sidebar( ‘rightsidebar’ ); ?>