Adding Sidebar in WordPress Themes.

This is one of the most used Requirements For many developers.
For adding custom sidebars in WordPress theme Paste the following code in your functions.php file:

function CustomSidebars() {
  $args = array(
    'id' => 'custom_sidebar',
    'before_title' => '<h4 class="widget-title">',
    'after_title' => '</h4>',
    'name' => __( 'Newly Added Custom Widget', 'text_domain' ),
    'description' => __( 'My First Custom Widget Area', 'text_domain' ),
    'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    'after_widget' => '</aside>',
// Register Sidebars
  register_sidebar( $args );
add_action( 'widgets_init', 'CustomSidebars' );


Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top