1

I want to add "Recent Posts" widget in a sidebar without a title but every time I add it, it shows "Recent Posts" text as title. How do I have it without title? I don't want to use any plugin for this.

Thank You.

2

This code will set the title to an empty string if it is set to Recent Posts (Which as you noted, is what the Recent Posts widget will set the title to if it is empty):

add_filter( 'widget_title', 'wpse_widget_title', 10, 3 );
function wpse_widget_title( $title, $instance, $id_base ) {
    if ( 'recent-posts' === $id_base && __( 'Recent Posts', 'text_domain' ) === $title ) {
        $title = '';    
    }

    return $title;
}

Another workaround is to set the title to the HTML entity for a space,   in the widget editor.

2

Go to 'Appearance -> Customize -> Additional CSS' and add:

.widget_recent_entries>h3 {
    display: none;
}

Click on 'Save&Publish'. Exit customizer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.