Site logo

Archived topic

Removing h2 class from widget headline

3 replies · Started by Norman on October 21, 2020

Viewing posts 1–4 of 4

I noticed that the widget-title of the sidebar widgets, etc is an h2. How can I change it so it has no headline class at all? I just want it to be bold text in a larger font size.

Hi there,

you can add this PHP snippet to your site:

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

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

How to add PHP: https://docs.generatepress.com/article/adding-php/

Then you can style it with this CSS:

.widget-title.custom {
   font-weight: bold;
   font-size: 24px;
}

Worked like a charm. Thank you :)

Glad to hear that

This archived topic is closed to new replies.