[wp-trac] [WordPress Trac] #12702: Enable sticky post checkbox for custom post type Publish metabox
WordPress Trac
wp-trac at lists.automattic.com
Wed Jul 7 20:46:49 UTC 2010
#12702: Enable sticky post checkbox for custom post type Publish metabox
-----------------------------+----------------------------------------------
Reporter: phlux0r | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: Future Release
Component: Post Types | Version:
Severity: normal | Keywords: needs-patch
-----------------------------+----------------------------------------------
Changes (by nacin):
* type: defect (bug) => feature request
Comment:
Replying to [comment:9 azizur]:
> This is my second patch on WordPress core so be gentle with your
reviews.
As requested:
Strings cannot be broken up like this: 'Stick this '. $post->post_type .'
to the front page'. Instead, we'd use sprintf notation, such as 'Stick
this %s to the front page'. However, that is not translatable, so we
wouldn't do that either.
In this case, I would suggest we introduce a new string: 'Stick this to
the front page', and just use that. If that is not obvious enough for
newer users (we have the Help tab remember that is used to explain what
'Stick' means anyway) then we can have one string that includes 'this
post' and one that just says 'this'. It beats needing to have a new string
registered by the post type.
post_type_supports() is a very fast function, so for readability purposes
it would be better to just use `post_type_supports('sticky-posts')`
instead of assigning it to a variable.
Also, instead of conditionally checking for the 'post' post_type, sticky-
posts should instead be added to the supports argument of the
register_post_type for the 'post' post type. Keep in mind such support
could also be removed via remove_post_type_support() -- internal post
types should be treated like any other custom post type as much as
possible.
Finally, something not addressed in the patch that I thought about when I
saw this ticket a few weeks ago. I think implementing this might cause
some themes or widgets to get a little weird. Some themes grab
get_option('sticky_posts') and send that right into a query via
`post__in`, which means they might end up with posts of custom post types
all of a sudden, and that might not be desired. I'm not sure if this is
something we need to prevent, as a custom post type is kind of a package
deal on a site, something the theme needs to be cognizant of and designed
for. (Alternatively, we could introduce a new option that stores all
sticky posts regardless of type.)
--
Ticket URL: <http://core.trac.wordpress.org/ticket/12702#comment:10>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list