• Hi there,

    How can I remove the “Recent Posts” title from the widget? I would like to remove it manually rather than using CSS.

    Is this possible? If so, can anyone tell me which file it’s in?

    Thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • You can put a non-breaking space in the Title field instead. Type it as   or maybe even a normal space would do it.

    Thread Starter thetoolman123

    (@thetoolman123)

    Thanks for the reply. I would rather remove it completely if possible?

    You can copy the core code for the widget and make a new widget with a different name, since I don’t think there are any filters in the widget code.

    If you change core code files, your change could be lost when you update to a new WP version.

    The core widget code is separate from the code for the core widget blocks (I think).

    You can use one of several plugins that provide different Recent Posts widgets.
    You could alter a plugin much easier than altering WP itself.

    Thread Starter thetoolman123

    (@thetoolman123)

    Thanks for the reply.

    How would I make a copy of the core widget code? Is this done in the Widgets area?

    You would go to wp-includes/widgets and copy the file class-widget-recent-posts.php to your child theme or a plugin folder.
    Edit it and change the class name (or it will give a fatal error of duplicate definition). And change the title to your preference (no title).

    To be able to use your widget, you will need to register it. Use the new class name as the parameter.

    function mynew_widgets_init() {
    	register_widget( 'myNewClass_Recent_Posts_Widget' );
    }
    add_action( 'widgets_init', 'mynew_widgets_init' );

    Be sure to load your new widget code, so it gets defined. (It’s different for plugin vs. theme.)

    Thread Starter thetoolman123

    (@thetoolman123)

    Thank you for that, I will try that 🙂

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Removing the “Recent Posts” title’ is closed to new replies.