[Support request] how can change the H2 tag to p tag of the widgets title

Home Forums Support [Support request] how can change the H2 tag to p tag of the widgets title

Home Forums Support how can change the H2 tag to p tag of the widgets title

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1442325
    zhu

    my website is craftscustom.com
    i have 4 widgets in thefooter, and i check the H TAG of them is H2
    how can i change that?

    #1442354
    David
    Staff
    Customer Support

    Hi there,

    you can add this PHP snippet:

    add_filter( 'generate_start_widget_title', 'widget_title_start_tag' );
    function widget_title_start_tag()
    { 
        return '<h4 class="widget-title">';
    }
    
    add_filter( 'generate_end_widget_title', 'widget_title_end_tag' );
    function widget_title_end_tag()
    { 
        return '</h4>';
    }

    Change the element tag to whatever you need.

    Adding PHP:
    https://docs.generatepress.com/article/adding-php/

    #1443555
    zhu

    after i add it,the checker shows that https://craftscustom.com/wp-content/uploads/2020/09/1.png

    #1443729
    David
    Staff
    Customer Support

    Where did you add the code ?
    And can you share the exact code you added

    #1618315
    Arkadiusz

    Hello
    Unfortunately, your method is not working properly.
    When applied, not only the widget title but also the entire content of the widget goes to the H4 header tag.
    And by the way, formatting the widget titles in the footer with the H2 header in 2020 is a bit embarrassing for the author of the theme. I am asking for help on the website mocdysleksji.pl and on the website in the preparation of dzielak.com.pl.
    Pozdrawiam
    Arkadiusz Dziełak

    #1618324
    Arkadiusz

    Hello David
    Mistake:
    return ‘</h4″>’;

    #1618373
    Arkadiusz

    I removed the quotation marks and it worked
    Moc dysleksji

    #1618391
    David
    Staff
    Customer Support

    Doh – sorry about that – fixed the code above!

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