Archived topic
Make Widget Titles and/or instead of Headings
5 replies · Started by culpable on July 19, 2019
Hiya,
When I add a <Title> to widgets on the home page (as shown here), I notice they are added as <h2>'s.
Is there any way that I can change this to make the <h2> a <p>, <span>, or otherwise?
I'd rather use <h2>'s (and other <h> tags) to denote the post structure, rather than being used as widget titles.
Thank you very much for your help :)
Hi there,
You should be able to change this using the Title Element option in your WP Show Posts options. It should be in the "Content" tab.
Let me know :)
Hiya Tom,
That will change the headings of the Posts titles – but I mean the widget title itself.
I've illustrated this in the images here: https://imgur.com/a/sXUUa28 :)
Ah, this should help: https://generatepress.com/forums/topic/changing-sidebar-h-tags/page/2/#post-711983
Let me know :)
Ah, wonderful. Since I wanted a <span> instead of a <h4> I used this code:
add_filter( 'generate_start_widget_title', function() {
return '<span class="widget-title">';
} );
add_filter( 'generate_end_widget_title', function() {
return '</span>';
} );
Thank you very much for your help Tom! :)
You're welcome! :)