Site logo

Archived topic

Changing Sidebar Widget Title From H2 to H6

3 replies · Started by John on June 10, 2020

Viewing posts 1–4 of 4

Hello,

I was wondering which template file I need to edit to change the default "widget-title" on the sidebars to H6 instead of an h2? Any help you can provide would be appreciated - thanks!

Hi there,

you can use these two filter hooks to change them:

https://docs.generatepress.com/article/generate_start_widget_title/
https://docs.generatepress.com/article/generate_end_widget_title/

your code would be something like this:

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

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

Worked great thank you David!!

You're welcome

This archived topic is closed to new replies.