WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#10612 closed enhancement (wontfix)

Extract recent comments code out of the widget

Reported by: Viper007Bond Owned by:
Milestone: Priority: normal
Severity: minor Version: 2.9
Component: Template Keywords: needs-patch
Focuses: Cc:

Description

For those of us who don't use a widgetized sidebar, there's no easy way to display recent comments without copy/pasting the widget's code or using a plugin.

The code used in the widget should be extracted into function(s) that can be used outside of the widget.

Change History (5)

comment:1 follow-up: azaozz5 years ago

Perhaps have a look at the_widget($widget, $instance = array(), $args = array()). It would output an instance of a widget. For recent comments it would be the_widget( 'WP_Widget_Recent_Comments' );.

comment:2 westi5 years ago

Relates to #10615

comment:3 in reply to: ↑ 1 Viper007Bond5 years ago

Replying to azaozz:

Perhaps have a look at the_widget($widget, $instance = array(), $args = array()). It would output an instance of a widget. For recent comments it would be the_widget( 'WP_Widget_Recent_Comments' );.

I had briefly thought about trying to get the widget run on it's own, but then I thought it wouldn't work due to settings, etc.

Good to know (I ended up using a plugin). Thanks!

comment:4 azaozz5 years ago

  • Resolution set to wontfix
  • Status changed from new to closed

It works pretty well, the settings can be hard-coded or use some code to change them depending on template, etc.

comment:5 Denis-de-Bernardy4 years ago

  • Milestone Unassigned deleted
Note: See TracTickets for help on using tickets.