WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/04/2010 04:58:43 PM (10 years ago)
Author:
ryan
Message:

More custom post type support. Props scribu. see #9674

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-form-advanced.php

    r12546 r12597  
    8686require_once('includes/meta-boxes.php');
    8787
    88 add_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', 'post', 'side', 'core');
     88add_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', $post_type, 'side', 'core');
    8989
    9090// all tag-style post taxonomies
    91 foreach ( get_object_taxonomies('post') as $tax_name ) {
     91foreach ( get_object_taxonomies($post_type) as $tax_name ) {
    9292    if ( !is_taxonomy_hierarchical($tax_name) ) {
    9393        $taxonomy = get_taxonomy($tax_name);
    9494        $label = isset($taxonomy->label) ? esc_attr($taxonomy->label) : $tax_name;
    9595
    96         add_meta_box('tagsdiv-' . $tax_name, $label, 'post_tags_meta_box', 'post', 'side', 'core');
     96        add_meta_box('tagsdiv-' . $tax_name, $label, 'post_tags_meta_box', $post_type, 'side', 'core');
    9797    }
    9898}
    9999
    100 add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', 'post', 'side', 'core');
    101 if ( current_theme_supports( 'post-thumbnails', 'post' ) )
    102     add_meta_box('postimagediv', __('Post Thumbnail'), 'post_thumbnail_meta_box', 'post', 'side', 'low');
    103 add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', 'post', 'normal', 'core');
    104 add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', 'post', 'normal', 'core');
    105 add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', 'post', 'normal', 'core');
     100if ( is_object_in_taxonomy($post_type, 'category') )
     101    add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', $post_type, 'side', 'core');
     102if ( current_theme_supports( 'post-thumbnails', $post_type ) )
     103    add_meta_box('postimagediv', __('Post Thumbnail'), 'post_thumbnail_meta_box', $post_type, 'side', 'low');
     104add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $post_type, 'normal', 'core');
     105add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', $post_type, 'normal', 'core');
     106add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', $post_type, 'normal', 'core');
    106107do_action('dbx_post_advanced');
    107 add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', 'post', 'normal', 'core');
     108add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', $post_type, 'normal', 'core');
    108109
    109110if ( 'publish' == $post->post_status || 'private' == $post->post_status )
    110     add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', 'post', 'normal', 'core');
     111    add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', $post_type, 'normal', 'core');
    111112
    112113if ( !( 'pending' == $post->post_status && !current_user_can( 'publish_posts' ) ) )
    113     add_meta_box('slugdiv', __('Post Slug'), 'post_slug_meta_box', 'post', 'normal', 'core');
     114    add_meta_box('slugdiv', __('Post Slug'), 'post_slug_meta_box', $post_type, 'normal', 'core');
    114115
    115116$authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
     
    117118    $authors[] = $post->post_author;
    118119if ( $authors && count( $authors ) > 1 )
    119     add_meta_box('authordiv', __('Post Author'), 'post_author_meta_box', 'post', 'normal', 'core');
     120    add_meta_box('authordiv', __('Post Author'), 'post_author_meta_box', $post_type, 'normal', 'core');
    120121
    121122if ( 0 < $post_ID && wp_get_post_revisions( $post_ID ) )
    122     add_meta_box('revisionsdiv', __('Post Revisions'), 'post_revisions_meta_box', 'post', 'normal', 'core');
    123 
    124 do_action('do_meta_boxes', 'post', 'normal', $post);
    125 do_action('do_meta_boxes', 'post', 'advanced', $post);
    126 do_action('do_meta_boxes', 'post', 'side', $post);
     123    add_meta_box('revisionsdiv', __('Post Revisions'), 'post_revisions_meta_box', $post_type, 'normal', 'core');
     124
     125do_action('do_meta_boxes', $post_type, 'normal', $post);
     126do_action('do_meta_boxes', $post_type, 'advanced', $post);
     127do_action('do_meta_boxes', $post_type, 'side', $post);
    127128
    128129require_once('admin-header.php');
     
    153154<input type="hidden" id="originalaction" name="originalaction" value="<?php echo esc_attr($form_action) ?>" />
    154155<input type="hidden" id="post_author" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" />
    155 <input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr($post->post_type) ?>" />
     156<input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr($post_type) ?>" />
    156157<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr($post->post_status) ?>" />
    157158<input name="referredby" type="hidden" id="referredby" value="<?php echo esc_url(stripslashes(wp_get_referer())); ?>" />
     
    167168<?php do_action('submitpost_box'); ?>
    168169
    169 <?php $side_meta_boxes = do_meta_boxes('post', 'side', $post); ?>
     170<?php $side_meta_boxes = do_meta_boxes($post_type, 'side', $post); ?>
    170171</div>
    171172
     
    224225<?php
    225226
    226 do_meta_boxes('post', 'normal', $post);
     227do_meta_boxes($post_type, 'normal', $post);
    227228
    228229do_action('edit_form_advanced');
    229230
    230 do_meta_boxes('post', 'advanced', $post);
     231do_meta_boxes($post_type, 'advanced', $post);
    231232
    232233do_action('dbx_post_sidebar'); ?>
Note: See TracChangeset for help on using the changeset viewer.