[Support request] How edit H2 To H4 in widget title?

Home Forums Support [Support request] How edit H2 To H4 in widget title?

Home Forums Support How edit H2 To H4 in widget title?

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #936626
    phan cong tai

    null

    #936734
    David
    Staff
    Customer Support

    Hi there,

    it requires 2 PHP filters to change them, one for the start and one for the end of the tag you can find them here:

    https://docs.generatepress.com/article/generate_start_widget_title/

    https://docs.generatepress.com/article/generate_end_widget_title/

    #936840
    phan cong tai

    I don’t understand, can you explain more clearly? Which part of the theme does the code change?

    #936863
    David
    Staff
    Customer Support

    So it requires PHP, this article explains the two options of adding it:

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

    And this is the function you would add to either your child theme functions file or the codwe snippets plugin:

    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>';
    }
    #1289708
    Simone Longato

    Hi David,

    I’ve the same issue.

    Is it possible your code (functions.php) does not “close” correctly the <h4> ?
    I’ve tried it on https://www.magnetmarketing.it/ but it change on h4.widget title all the footer widget text.

    Thanks

    #1289791
    Simone Longato

    Sorry David,

    I just solved with:

    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">';
    }

    Thanks!

    #1289831
    David
    Staff
    Customer Support

    Hi there,

    glad to hear that –
    FYI – i corrected an error in my code here:
    https://generatepress.com/forums/topic/how-edit-h2-to-h4-in-widget-title/#post-936863

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