Archived topic
how can change the H2 tag to p tag of the widgets title
7 replies · Started by zhu on September 14, 2020
my website is craftscustom.com
i have 4 widgets in thefooter, and i check the H TAG of them is H2
how can i change that?
Hi there,
you can add this PHP snippet:
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>';
}
Change the element tag to whatever you need.
Adding PHP:
https://docs.generatepress.com/article/adding-php/
after i add it,the checker shows that https://craftscustom.com/wp-content/uploads/2020/09/1.png
Where did you add the code ?
And can you share the exact code you added
Hello
Unfortunately, your method is not working properly.
When applied, not only the widget title but also the entire content of the widget goes to the H4 header tag.
And by the way, formatting the widget titles in the footer with the H2 header in 2020 is a bit embarrassing for the author of the theme. I am asking for help on the website mocdysleksji.pl and on the website in the preparation of dzielak.com.pl.
Pozdrawiam
Arkadiusz Dziełak
Hello David
Mistake:
return '</h4">';
I removed the quotation marks and it worked
Moc dysleksji
Doh - sorry about that - fixed the code above!