WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 7 years ago

#16159 closed enhancement (fixed)

Default widgets "args" filters

Reported by: ramiy Owned by: nacin
Milestone: 3.4 Priority: normal
Severity: normal Version: 3.0.4
Component: Widgets Keywords: has-patch commit
Focuses: Cc:

Description (last modified by scribu)

Not all WordPress default widgets has arguments filter. For example, recentet-posts and recentet-comments has no arguments filte.

Current arg Filters:

  • Pages widget - wp_list_pages( apply_filters( 'widget_pages_args', array(...) );
  • Links widget - wp_list_bookmarks( apply_filters( 'widget_links_args', array(...) );
  • Archives widget - wp_get_archives( apply_filters( 'widget_archives_args', array(...) );
  • Tag Cloud widget - wp_tag_cloud( apply_filters( 'widget_tag_cloud_args', array(...) );

New arg Filters:

  • Recent Post widget - new WP_Query( apply_filters( ''''widget_posts_args'''', array(...) );
  • Recent Comments widget - get_comments( apply_filters( ''''widget_comments_args'''', array(...) );

This way i can add new arg to recent-posts widget and recent-comments widget using simple filters (i dont like installing plugins, i prefer filters).

Attachments (2)

16159.patch (3.1 KB) - added by ramiy 9 years ago.
16159.2.patch (1.3 KB) - added by scribu 8 years ago.

Download all attachments as: .zip

Change History (8)

@ramiy
9 years ago

#1 @ramiy
9 years ago

  • Cc ramiy added
  • Keywords has-patch dev-feedback added

#2 follow-up: @mdawaffe
9 years ago

  • Milestone changed from Awaiting Review to Future Release

Would it also be useful to pass those filters the $args and/or $instance variables?

#3 @scribu
8 years ago

  • Description modified (diff)
  • Keywords changed from has-patch, dev-feedback to has-patch dev-feedback
  • Severity changed from major to normal

#4 in reply to: ↑ 2 @scribu
8 years ago

  • Milestone changed from Future Release to 3.4

Patch refreshed. Let's get these in already.

We can decide if we want to also pass $instance and $args afterwards.

@scribu
8 years ago

#5 @scribu
8 years ago

  • Keywords commit added; dev-feedback removed

#6 @nacin
7 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In [20047]:

Add widget_comments_args and widget_post_args filters. props ramiy, fixes #16159.

Note: See TracTickets for help on using tickets.