[Resolved] Make Widget Titles and/or instead of Headings

Home Forums Support [Resolved] Make Widget Titles and/or instead of Headings

Home Forums Support Make Widget Titles and/or instead of Headings

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #961748
    culpable

    Hiya,

    When I add a <Title> to widgets on the home page (as shown here), I notice they are added as <h2>’s.

    Is there any way that I can change this to make the <h2> a <p>, <span>, or otherwise?

    I’d rather use <h2>’s (and other <h> tags) to denote the post structure, rather than being used as widget titles.

    Thank you very much for your help πŸ™‚

    #962124
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    You should be able to change this using the Title Element option in your WP Show Posts options. It should be in the “Content” tab.

    Let me know πŸ™‚

    #962380
    culpable

    Hiya Tom,

    That will change the headings of the Posts titles – but I mean the widget title itself.

    I’ve illustrated this in the images here: https://imgur.com/a/sXUUa28 πŸ™‚

    #962597
    Tom
    Lead Developer
    Lead Developer
    #963040
    culpable

    Ah, wonderful. Since I wanted a <span> instead of a <h4> I used this code:

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

    Thank you very much for your help Tom! πŸ™‚

    #963072
    Tom
    Lead Developer
    Lead Developer

    You’re welcome! πŸ™‚

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