[wp-trac] [WordPress Trac] #17954: add function wp_dropdown_posttypes();

WordPress Trac wp-trac at lists.automattic.com
Fri Jul 1 05:48:45 UTC 2011


#17954: add function wp_dropdown_posttypes();
-------------------------+------------------------------
 Reporter:  wpsmith      |       Owner:  Travis Smith
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Post Types   |     Version:  3.2
 Severity:  normal       |  Resolution:
 Keywords:  close        |
-------------------------+------------------------------
Changes (by nacin):

 * keywords:  dev-feedback 2nd-opinion needs-testing => close


Comment:

 Until core is going to use this, I don't see why we need this.

 For one, it tries to do too much. You'd be better off just doing it on a
 case-by-case basis. It's a pretty simple piece of code when you get down
 to it:

 {{{
 <select name="post_type">
 <?php
 $_selected = 'post';
 $pts = get_post_types();
 foreach ( get_post_types( array(), 'objects' ) as $pt ) :
 ?>
     <option value="<?php echo $pt->name; ?>"
         <?php selected( $pt->name, $_selected ); ?>>
         <?php echo $pt->labels->name; ?>
     </option>
 <?php
 endforeach;
 ?>
 </select>
 }}}

 Two, it never will be used, because post types are distinct objects that
 are not to be mixed in the user interface.

 P.S. your gravatar is a fauxgo: http://wordpress.org/about/logos/.

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


More information about the wp-trac mailing list