Replacing Default Widget Header Tags - kary4/divituts GitHub Wiki

Add this code into the functions.php file in your child theme folder:

function et_my_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'Divi' ),
'id' => 'sidebar-1',
'before_widget' => '<div id="%1$s" class="et_pb_widget %2$s">',
'after_widget' => '</div> <!— end .et_pb_widget —>',
'before_title' => '<strong class="widgettitle">',
'after_title' => '</strong>',
) );

register_sidebar( array(
'name' => esc_html__( 'Footer Area', 'Divi' ) . ' #1',
'id' => 'sidebar-2',
'before_widget' => '<div id="%1$s" class="fwidget et_pb_widget %2$s">',
'after_widget' => '</div> <!— end .fwidget —>',
'before_title' => '<strong class="title">',
'after_title' => '</strong>',
) );

register_sidebar( array(
'name' => esc_html__( 'Footer Area', 'Divi' ) . ' #2',
'id' => 'sidebar-3',
'before_widget' => '<div id="%1$s" class="fwidget et_pb_widget %2$s">',
'after_widget' => '</div> <!— end .fwidget —>',
'before_title' => '<strong class="title">',
'after_title' => '</strong>',
) );

register_sidebar( array(
'name' => esc_html__( 'Footer Area', 'Divi' ) . ' #3',
'id' => 'sidebar-4',
'before_widget' => '<div id="%1$s" class="fwidget et_pb_widget %2$s">',
'after_widget' => '</div> <!— end .fwidget —>',
'before_title' => '<strong class="title">',
'after_title' => '</strong>',
) );

register_sidebar( array(
'name' => esc_html__( 'Footer Area', 'Divi' ) . ' #4',
'id' => 'sidebar-5',
'before_widget' => '<div id="%1$s" class="fwidget et_pb_widget %2$s">',
'after_widget' => '</div> <!— end .fwidget —>',
'before_title' => '<strong class="title">',
'after_title' => '</strong>',
) );
}

function et_my_init_widget_areas() {
remove_action( 'widgets_init', 'et_widgets_init' );

add_action( 'widgets_init', 'et_my_widgets_init' );
}
add_action( 'after_setup_theme', 'et_my_init_widget_areas', 11 );

In the code you can see the following line many times: before_title This means it the opening html tag for the title, for example replace the <strong class="title"> with <h4 class="title">

Similarly do the same for the after_title option.

⚠️ **GitHub.com Fallback** ⚠️