[Resolved] How to implement instead of for footer widgets

Home Forums Support [Resolved] How to implement instead of for footer widgets

Home Forums Support How to implement instead of for footer widgets

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1609148
    Greg

    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

    #1609211
    David
    Staff
    Customer Support

    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.

    #1609293
    Greg

    Thanks!

    May I ask which file that goes into, and should I create a child theme?

    #1609302
    David
    Staff
    Customer Support

    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 )

    #1609305
    Greg

    Ok, thanks!

    #1609400
    David
    Staff
    Customer Support

    You’re welcome

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.