Change Sidebar Widget Title Heading Tag

Change Sidebar Widget Title Heading Tag

When you add a widget in the sidebar, a default heading tag that will be applied to widget title is H2

If you wish to change this heading tag use the following custom code. Add the code in the child theme』s functions.php file. 

add_filter( 'astra_widgets_init', 'widget_title_tag', 10, 1 );

function widget_title_tag( $atts ) {
$atts['before_title'] = '

';
$atts['after_title'] = '

';

return $atts;
}

In the above code H2 heading tag is changed to H4. You can enter the required heading tag as per your requirement.

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注