[wp-trac] [WordPress Trac] #12702: Enable sticky post checkbox for custom post type Publish metabox

WordPress Trac wp-trac at lists.automattic.com
Tue Jul 13 22:13:10 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   
-----------------------------+----------------------------------------------

Comment(by azizur):

 Thank you Andrew for your feedback.

 I am thinking how best to implement this patch. My working copy does the
 following:

 For each custom_post_type there will be a additional
 sticky_{custom_post_type} option. Which will leave current sticky_posts
 option untouched. Only drawback on this is that we'd end up with more
 options (one per custom_post_type).


 Replying to [comment:10 nacin]:
 > 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.)


 Here is what I am thinking of doing and would be interested on your views.

 How about converting the option 'sticky_posts' to a object for example:

 sticky_posts => array('posts'=>array(current_data), 'custom_1'=>array(),
 'custom_N'=>array());

 This would reduce the number of options but also would break any plugin
 currently accessing this option directly.

 Replying to [comment:10 nacin]:
 > ... 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. ...

 We could introduce a new default conditional parameter 'show_all_sticky'
 == false on get_posts() and use it to address above issue.

 This will give developers additional query parameter to get combined
 sticky post across all post_types that has support for 'sticky'. Good for
 grabing all the stickies and then display accordingly.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/12702#comment:11>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list