[Resolved] Removing h2 class from widget headline

Home Forums Support [Resolved] Removing h2 class from widget headline

Home Forums Support Removing h2 class from widget headline

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1497932
    Norman

    I noticed that the widget-title of the sidebar widgets, etc is an h2. How can I change it so it has no headline class at all? I just want it to be bold text in a larger font size.

    #1498138
    David
    Staff
    Customer Support

    Hi there,

    you can add this PHP snippet to your site:

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

    How to add PHP: https://docs.generatepress.com/article/adding-php/

    Then you can style it with this CSS:

    .widget-title.custom {
       font-weight: bold;
       font-size: 24px;
    }
    #1498178
    Norman

    Worked like a charm. Thank you 🙂

    #1498181
    David
    Staff
    Customer Support

    Glad to hear that

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