Site logo

Archived topic

How edit H2 To H4 in widget title?

6 replies · Started by phan cong tai on June 21, 2019

Viewing posts 1–7 of 7

null

I don't understand, can you explain more clearly? Which part of the theme does the code change?

So it requires PHP, this article explains the two options of adding it:

https://docs.generatepress.com/article/adding-php/

And this is the function you would add to either your child theme functions file or the codwe snippets plugin:

add_filter( 'generate_start_widget_title', 'widget_title_start_tag' );
function widget_title_start_tag()
{ 
    return '<h4 class="widget-title">';
}

add_filter( 'generate_end_widget_title', 'widget_title_end_tag' );
function widget_title_end_tag()
{ 
    return '</h4>';
}

Hi David,

I've the same issue.

Is it possible your code (functions.php) does not "close" correctly the <h4> ?
I've tried it on https://www.magnetmarketing.it/ but it change on h4.widget title all the footer widget text.

Thanks

Sorry David,

I just solved with:

add_filter( 'generate_start_widget_title', 'widget_title_start_tag' );
function widget_title_start_tag()
{ 
    return '<h4 class="widget-title">';
}

add_filter( 'generate_end_widget_title', 'widget_title_end_tag' );
function widget_title_end_tag()
{ 
    return '</h4">';
}

Thanks!

This archived topic is closed to new replies.