Archived topic
Change the footer widgets titles from h2 to simple
14 replies · Started by Sam on May 7, 2018
Hello everyone,
I am developing a WordPress site using GP + GP Premium, I want to change the footer widgets titles tags from <h2> to <p>.
In my child theme i did create a (inc folder) and put the footer.php inside it and changed the tags but it didn't work.
Thank you so much :)
You can use filters to change the tags, here is a post from Tom:
https://generatepress.com/forums/topic/footer-widget-heading-h2/#post-474609
Let me know if this helps.
Thank you David,
That was helpful, but is there any way to change it editing the footer.php inside the INC FOLDER?
Thank you
I did use Tom's method but it didn't work ...
add_filter( 'acs-footer-widgets-titles','generate_start_widget_title' );
function generate_start_widget_title()
{
return '<p class="widget-title">';
}
add_filter( 'generate_end_widget_title','generate_end_widget_title' );
function generate_end_widget_title()
{
return '</p>';
}
Am I doing anything wrong here?
Try:
add_filter( 'generate_start_widget_title', 'db_start_widget_title' );
function db_start_widget_title()
{
return '<p class="widget-title">';
}
add_filter( 'generate_end_widget_title', 'db_end_widget_title' );
function db_end_widget_title()
{
return '</p>';
}
Hey David,
Thank you so much that worked perfect :)
Thats great to hear. Glad i could help
I tried to add this as an Element, but all that happened was the code appeared at the bottom of the page. I created it as a Hook, and checked "Execute PHP". What do I need to do to make this work?
Hi Martin,
This article covers adding PHP:
https://docs.generatepress.com/article/adding-php/
If you're not using a Child Theme then the linked Code Snippets plugin is a great alternative.
Got it. I thought since a Hook had an "Execute PHP" checkbox that it would have worked.
You're welcome.
Hello,
Can you please confirm if the following code needs to be added to footer.php or functions.php? I basically need to change titles of footer widgets (like recent comments, copyright statement etc) to <p> from the default <h2>.
Thanks in advance!
add_filter( 'generate_start_widget_title', 'db_start_widget_title' );
function db_start_widget_title()
{
return '<p class="widget-title">';
}
add_filter( 'generate_end_widget_title', 'db_end_widget_title' );
function db_end_widget_title()
{
return '</p>';
}
Hi Belinda,
See my reply on your topic here:
https://generatepress.com/forums/topic/change-footer-widget-titles-from-h2-to-paragraph/#post-1676750
Thanks. :)
I had to do the same thing for a customer. Found this solution with Google in less than 60 seconds, and it worked perfectly. Great support forum. And such a neat solution. Most themes would need some modification of the original template. As always, GP is much better! Thanks a lot!
Glad to hear you found it useful!