Archived topic
How to implement instead of for footer widgets
5 replies · Started by Greg on January 7, 2021
Hi,
Currently <h2> is being used for the titles of footer widgets. For example, down in the footer there is a column/widget with <h2>Pages</h2> followed by "Terms and Conditions," "Cookie Policy," etc. (unordered list).
I didn't find how to change the element of the widget title, e.g., change it to <p>Pages</p>. Is this possible in GeneratePress? Thanks
Hi there,
theres not one specifically for the Footer widgets, but you can change all widget titles ( this will apply to any widget areas ) by adding this PHP Snippet:
add_filter( 'generate_start_widget_title', 'widget_title_start_tag' );
function widget_title_start_tag()
{
return '<p>';
}
add_filter( 'generate_end_widget_title', 'widget_title_end_tag' );
function widget_title_end_tag()
{
return '</p>';
}
Alternatively you can NOT add a title and insert your own HTML block above the widget to add your own title.
Thanks!
May I ask which file that goes into, and should I create a child theme?
This article explains how to add that code ( PHP ):
https://docs.generatepress.com/article/adding-php/
TLDR: If you have a Child Theme it will go in the Child Themes functions.php - if you don't want a child theme then use the Code Snippets plugin ( link in the above doc )
Ok, thanks!
You're welcome