Change Footer Widget Title』s Heading Tag

Change Footer Widget Title』s Heading Tag

When you add a widget in the footer, 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 respective filter code in the child theme』s functions.php file. 

// Footer Widget 1
add_filter( 'astra_advanced_footer_widget_1_args', 'widget_title_footer_1_tag', 10, 1 );

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

';
$atts['after_title'] = '

';
return $atts;
}

// Footer Widget 2
add_filter( 'astra_advanced_footer_widget_2_args', 'widget_title_footer_2_tag', 10, 1 );

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

';
$atts['after_title'] = '

';
return $atts;
}

// Footer Widget 3
add_filter( 'astra_advanced_footer_widget_3_args', 'widget_title_footer_3_tag', 10, 1 );

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

';
$atts['after_title'] = '

';
return $atts;
}

// Footer Widget 4
add_filter( 'astra_advanced_footer_widget_4_args', 'widget_title_footer_4_tag', 10, 1 );

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

';
$atts['after_title'] = '

';
return $atts;
}

// Footer Widget 5
add_filter( 'astra_advanced_footer_widget_5_args', 'widget_title_footer_5_tag', 10, 1 );

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

';
$atts['after_title'] = '

';
return $atts;
}

You can choose from the required filter for the respective widget and update the tag as per your requirement.

For e.g. You are looking to update the Third Footer widget title for that you will need to copy the code just as below and paste it in your child theme』s functions.php.

add_filter( 'astra_advanced_footer_widget_3_args', 'widget_title_footer_3_tag', 10, 1 );

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

';
$atts['after_title'] = '

';
return $atts;
}

Note:

If you have built the Footer using the Footer builder of Header Footer builder, please use the below code –

add_filter( 'astra_footer_widget_1args', 'widget_title_footer_1_tag', 10, 1 );

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

';
$atts['after_title'] = '

';
return $atts;
}

Note:

Please note, that you pick the correct filter having the number and update the heading tags h4 or other as required.Refer this doc on How to Add Custom PHP Code?

发表回复

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