[wp-trac] [WordPress Trac] #9674: Better support for custom post types

WordPress Trac wp-trac at lists.automattic.com
Thu Jan 7 16:02:40 UTC 2010


#9674: Better support for custom post types
------------------------------------+---------------------------------------
 Reporter:  wnorris                 |        Owner:  ryan    
     Type:  task (blessed)          |       Status:  reopened
 Priority:  normal                  |    Milestone:  3.0     
Component:  Administration          |      Version:  2.9     
 Severity:  normal                  |   Resolution:          
 Keywords:  has-patch tested early  |  
------------------------------------+---------------------------------------

Comment(by prettyboymp):

 Replying to [comment:112 youngmicroserf]:

 A good starting point would be just replacing all the default add_meta_box
 calls in edit-form-advanced.php with a do_action('add_metaboxes', $post)
 and moving those into something like the following:


 {{{
 function add_core_post_metaboxes($post)
 {
   add_meta_box('categorydiv', __('Categories'),
 'post_categories_meta_box', 'post', 'side', 'core');
         if ( current_theme_supports( 'post-thumbnails', 'post' ) )
                 add_meta_box('postimagediv', __('Post Thumbnail'),
 'post_thumbnail_meta_box', 'post', 'side', 'low');
         add_meta_box('postexcerpt', __('Excerpt'),
 'post_excerpt_meta_box', 'post', 'normal', 'core');
         add_meta_box('trackbacksdiv', __('Send Trackbacks'),
 'post_trackback_meta_box', 'post', 'normal', 'core');
         add_meta_box('postcustom', __('Custom Fields'),
 'post_custom_meta_box', 'post', 'normal', 'core');
         add_meta_box('commentstatusdiv', __('Discussion'),
 'post_comment_status_meta_box', 'post', 'normal', 'core');

         if ( 'publish' == $post->post_status || 'private' ==
 $post->post_status )
                 add_meta_box('commentsdiv', __('Comments'),
 'post_comment_meta_box', 'post', 'normal', 'core');

         if ( !( 'pending' == $post->post_status && !current_user_can(
 'publish_posts' ) ) )
                 add_meta_box('slugdiv', __('Post Slug'),
 'post_slug_meta_box', 'post', 'normal', 'core');

         $authors = get_editable_user_ids( $current_user->id ); // TODO:
 ROLE SYSTEM
         if ( $post->post_author && !in_array($post->post_author, $authors)
 )
                 $authors[] = $post->post_author;
         if ( $authors && count( $authors ) > 1 )
                 add_meta_box('authordiv', __('Post Author'),
 'post_author_meta_box', 'post', 'normal', 'core');

         if ( 0 < $post_ID && wp_get_post_revisions( $post_ID ) )
                 add_meta_box('revisionsdiv', __('Post Revisions'),
 'post_revisions_meta_box', 'post', 'normal', 'core');
 }
 add_action('add_meta_boxes', 'register_core_post_metaboxes', 1, 1);
 }}}

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


More information about the wp-trac mailing list