[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 15 posts - 1 through 15 (of 15 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 πŸ™‚

    #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

    You’re welcome.

    #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
    #1845388
    mkjj

    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!

    #1845427
    David
    Staff
    Customer Support

    Glad to hear you found it useful!

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