WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 5 years ago

#22590 closed enhancement (fixed)

get_post_class() do not set 'sticky' class in administration posts table

Reported by: corsonr Owned by:
Milestone: 4.0 Priority: normal
Severity: minor Version: 3.4.2
Component: Posts, Post Types Keywords: has-patch needs-testing
Focuses: ui, administration Cc:
PR Number:

Description (last modified by SergeyBiryukov)

get_post_class() does set a 'sticky' class to sticky post on the frontend but not in the administration. So, there's no way to differentiate a sticky post from another non-sticky post excepted the span element to its right.

Adding something similar to this fix the problem:

	// sticky for Sticky Posts in administration
	if ( is_sticky($post->ID) && is_admin() )
		$classes[] = 'post-sticky';

Attachments (2)

get_post_class.diff (497 bytes) - added by mordauk 7 years ago.
Adds "post-sticky" class for sticky posts in the admin list tables.
22590.diff (517 bytes) - added by netweb 6 years ago.
Use 'status-' prefix rather than 'post-' for consistent admin post_status classes

Download all attachments as: .zip

Change History (12)

#1 @SergeyBiryukov
7 years ago

  • Component changed from Appearance to Administration

#2 @SergeyBiryukov
7 years ago

  • Description modified (diff)

#3 @DrewAPicture
7 years ago

  • Cc xoodrew@… added

This seems like an easy win. I'd say +1, except I wonder if there other existing instances of applying post classes in the admin and if so, what are their use-cases in core?

#4 @corsonr
7 years ago

Here is an simple example i did with this plugin: http://remicorson.com/color-my-posts/

@mordauk
7 years ago

Adds "post-sticky" class for sticky posts in the admin list tables.

#5 @corsonr
7 years ago

here is another sample of how this can be used, http://codecanyon.net/item/color-my-posts-pro/3653526

#6 @SergeyBiryukov
7 years ago

  • Keywords has-patch added; needs-patch removed

@netweb
6 years ago

Use 'status-' prefix rather than 'post-' for consistent admin post_status classes

#7 @helen
6 years ago

  • Focuses ui added

Related: #26928

#8 @nacin
6 years ago

  • Component changed from Administration to Posts, Post Types
  • Focuses administration added

#9 @wonderboymusic
5 years ago

  • Milestone changed from Awaiting Review to 4.0

#10 @SergeyBiryukov
5 years ago

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

In 29003:

Add 'status-sticky' class in get_post_class() for sticky posts in the admin.

props mordauk, netweb.
fixes #22590.

Note: See TracTickets for help on using tickets.