Make WordPress Core

Opened 13 years ago

Closed 11 years ago

#15323 closed enhancement (wontfix)

Filter by post format in wp-admin/edit

Reported by: petemall's profile PeteMall Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.1
Component: Post Formats Keywords: has-patch
Focuses: Cc:

Description

There should be a post formats drop-down in edit.php so users can easily see all posts of a particular format.

Attachments (3)

posts.png (24.5 KB) - added by PeteMall 13 years ago.
Post Format Filter
15323.diff (1.7 KB) - added by wonderboymusic 11 years ago.
15323.patch (1.7 KB) - added by sscovil 11 years ago.

Download all attachments as: .zip

Change History (26)

@PeteMall
13 years ago

Post Format Filter

#1 @PeteMall
13 years ago

  • Milestone changed from 3.1 to Future Release

#2 @SergeyBiryukov
11 years ago

  • Component changed from UI to Administration
  • Type changed from defect (bug) to enhancement

#3 @helen
11 years ago

#17280 was marked as a duplicate.

#5 @DrewAPicture
11 years ago

  • Cc DrewAPicture added

#6 @sabreuse
11 years ago

  • Cc sabreuse added

#7 @WraithKenny
11 years ago

  • Cc Ken@… added

#8 @beaulebens
11 years ago

  • Cc beau@… added

#9 @beaulebens
11 years ago

FWIW, here's what I'm currently using in a theme I'm working on:

function homeroom_manage_posts_formats( &$wp_query ) {
	if ( !is_admin() )
		return;

	if ( function_exists( 'get_current_screen' ) && $screen = get_current_screen() ) {
		if ( is_object( $screen ) && 'post' !== $screen->post_type )
			return;
	}

	if ( empty( $_REQUEST['format'] ) )
		return;

	$post_format_tax_query = array(
		'taxonomy' => 'post_format',
		'field'    => 'slug',
		'terms'    => 'post-format-' . esc_attr( $_REQUEST['format'] ),
		'operator' => 'IN'
	);
	$tax_query = $wp_query->get( 'tax_query' );
	if ( is_array( $tax_query ) ) {
		$tax_query = $tax_query + $post_format_tax_query;
	} else {
		$tax_query = array( $post_format_tax_query );
	}
	$wp_query->set( 'tax_query', $tax_query );
}
add_action( 'pre_get_posts', 'homeroom_manage_posts_formats' );

#10 @wonderboymusic
11 years ago

  • Keywords has-patch added; needs-patch removed
  • Milestone changed from Future Release to 3.6

#11 follow-up: @DrewAPicture
11 years ago

RE: 15323.diff

Along the vein of ticket:16047:16, if we're going to show a column on edit.php shouldn't we allow filtering by post format regardless of whether there is theme support?

#12 @DrewAPicture
11 years ago

  • Cc xoodrew@… added; DrewAPicture removed

#13 in reply to: ↑ 11 ; follow-up: @helen
11 years ago

Replying to DrewAPicture:

shouldn't we allow filtering by post format regardless of whether there is theme support?

I'm not seeing a check for theme support in the patch - am I missing something?

#14 in reply to: ↑ 13 @DrewAPicture
11 years ago

Replying to helen:

I'm not seeing a check for theme support in the patch - am I missing something?

That's my bad. I saw the post type supports check and it didn't click.

#15 @helen
11 years ago

  • Component changed from Administration to Post Formats

@sscovil
11 years ago

#16 @sscovil
11 years ago

Because terms are not created until a post format is used, we should probably use 'hide_if_empty'. Added a new patch.

#17 @helen
11 years ago

This filter may actually be a time where #16149 sounds nice.

#18 follow-up: @maor
11 years ago

  • Cc maorhaz@… added

While I do like this idea, I'd suggest a way for users who are not interested in this additional dropdown to be able to easily hide it. We can do it by simply adding a filter to the post_type_supports check , that is automatically set to true. Here's what I mean:

...

if ( post_type_supports( $this->screen->post_type, 'post-formats' ) && apply_filters( 'show_post_formats_dropdown', true ) ) { 

...

Or we can be a bit more specific and allow extra control, up to a level of a post type.

...

if ( post_type_supports( $this->screen->post_type, 'post-formats' ) && apply_filters( "show_post_formats_dropdown_for_{$this->screen->post_type}", true ) ) { 

...

What do you guys think about this approach?

#19 @helen
11 years ago

We don't do it for categories, so why for post formats?

#20 in reply to: ↑ 18 @sscovil
11 years ago

@maor: I agree with @helen. Plus, keep in mind that if a user has not made use of any post format other than 'standard', this filter option does not appear.

#21 @nacin
11 years ago

I am hesitating here — is this needed UI? We're going to try to avoid a column for 3.6, and instead have an icon (with alternative text / tooltip / etc) that is clickable, just like items listed in the current post format, author, and other taxonomy columns.

As it is, we have too many items across the top; they have a tendency to wrap on even 1024 screens. I'd rather they go away, not grow.

#22 @helen
11 years ago

Eh, I'm not in love with those filters, either. If the icons are clickable to filter, that's a fine solution to me, and also neatly avoids the querying for standard posts thing.

#23 @markjaquith
11 years ago

  • Milestone 3.6 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

We're going to make clickable icons, and then we can lose the column entirely, and just let clicking the icon be the filtering method.

#16047

Note: See TracTickets for help on using tickets.