Celebrating 7 Years! Get up to $30 off GeneratePress Premium!

[Resolved] Change the footer widgets titles from h2 to simple

Home Forums Support [Resolved] Change the footer widgets titles from h2 to simple

Home Forums Support Change the footer widgets titles from h2 to simple

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #569532
    Sam

    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 πŸ™‚

    GeneratePress 2.1
    #569549
    David
    Staff
    Customer Support

    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.

    #569552
    Sam

    Thank you David,

    That was helpful, but is there any way to change it editing the footer.php inside the INC FOLDER?

    Thank you

    #569558
    Sam

    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?

    #569575
    David
    Staff
    Customer Support

    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>';
    }
    #569822
    Sam

    Hey David,

    Thank you so much that worked perfect πŸ™‚

    #569833
    David
    Staff
    Customer Support

    Thats great to hear. Glad i could help

    #688122
    Martin

    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?

    See https://www.screencast.com/t/LYmna7iJPj5

    #688132
    David
    Staff
    Customer Support

    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.

    #688162
    Martin

    Got it. I thought since a Hook had an “Execute PHP” checkbox that it would have worked.

    #688178
    David
    Staff
    Customer Support
    #1676711
    Belinda

    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>';
    }
    #1676754
    Elvin
    Staff
    Customer Support

    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. πŸ™‚

    A wise man once said:
    "Have you cleared your cache?"

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