WordPress Custom Sidebar

Wordpress Custom Sidebar register_sidebar()

The register_sidebar() function is used to create a custom sidebar in WordPress.

To access the created Sidebars: Appearance > Components in the WordPress panel.

register_sidebar() Code

   'name' => __('Example Sidebar', 'example-sidebar'), 
   'id' => 'example_sidebar', 
   'description' => '', 
   'class' => '', 
   'before_widget' => '', 
   'after_widget' => '', 
   'before_title' => '', 
   'after_title' => '', 
   'before_sidebar' => '', 
   'after_sidebar' => '', 
   'show_in_rest' => false 

register_sidebar Parameters

  • name

    Creates the name of the Sidebar in the panel.

    register_sidebar name
  • id

    The unique identifier id is used to call the sidebar.

  • description

    It is the description area under the Sidebar in the Widgets section of the WordPress panel. The default value is blank.

    register_sidebar description

Displaying Sidebar Output on the Page

if (is_active_sidebar('example_sidebar')) : dynamic_sidebar('example_sidebar'); endif;