Site logo

Archived topic

H3 Widget Titles

1 reply · Started by Jesse on June 1, 2021

Viewing posts 1–2 of 2

Hello,

I previously used this filter to change all my widget titles from H2 to H3:

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

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

However, now I want to make it so the widget title is a <p> instead of an <h3> only if the widget title is "Follow us" - Can this be done?

Best regards,
Jesse

Hi there,

its not possible to selectively filter individual widget titles.
If you can use a HTML Widget to output your 'follow us' widget content, then exclude the Title and add paragraph within the HTML for you title.

eg.

<p class="widget-title">Follow us</p>

By adding the widget-title class it will keep the title styling.

This archived topic is closed to new replies.