WordPress.org

Make WordPress Core


Ignore:
Timestamp:
03/15/2010 09:16:41 PM (11 years ago)
Author:
ryan
Message:

Allow enabling/disabling title and editor per post type. Introdoce remove_post_type_support(). Add enable/disable for author override. Props scribu. fixes #12590

File:
1 edited

Legend:

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

    r13635 r13710  
    107107    add_meta_box('pageparentdiv', __('Attributes'), 'page_attributes_meta_box', $post_type, 'side', 'core');
    108108
    109 if ( current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports($post_type, 'post-thumbnails') )
     109if ( current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports($post_type, 'thumbnail') )
    110110    add_meta_box('postimagediv', __('Post Thumbnail'), 'post_thumbnail_meta_box', $post_type, 'side', 'low');
    111111
    112 if ( post_type_supports($post_type, 'excerpts') )
     112if ( post_type_supports($post_type, 'excerpt') )
    113113    add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $post_type, 'normal', 'core');
    114114
     
    129129    add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', $post_type, 'normal', 'core');
    130130
    131 $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
    132 if ( $post->post_author && !in_array($post->post_author, $authors) )
    133     $authors[] = $post->post_author;
    134 if ( $authors && count( $authors ) > 1 )
    135     add_meta_box('authordiv', __('Author'), 'post_author_meta_box', $post_type, 'normal', 'core');
     131if ( post_type_supports($post_type, 'author') ) {
     132    $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
     133    if ( $post->post_author && !in_array($post->post_author, $authors) )
     134        $authors[] = $post->post_author;
     135    if ( $authors && count( $authors ) > 1 )
     136        add_meta_box('authordiv', __('Author'), 'post_author_meta_box', $post_type, 'normal', 'core');
     137}
    136138
    137139if ( post_type_supports($post_type, 'revisions') && 0 < $post_ID && wp_get_post_revisions( $post_ID ) )
     
    185187<div id="post-body">
    186188<div id="post-body-content">
     189<?php if ( post_type_supports($post_type, 'title') ) { ?>
    187190<div id="titlediv">
    188191<div id="titlewrap">
     
    199202if ( !( 'pending' == $post->post_status && !current_user_can( $post_type_object->publish_cap ) ) ) { ?>
    200203    <div id="edit-slug-box">
    201 <?php
    202     if ( ! empty($post->ID) && ! empty($sample_permalink_html) && 'auto-draft' != $post->post_status ) :
    203         echo $sample_permalink_html;
    204 endif; ?>
     204    <?php
     205        if ( ! empty($post->ID) && ! empty($sample_permalink_html) && 'auto-draft' != $post->post_status )
     206            echo $sample_permalink_html;
     207    ?>
    205208    </div>
    206209<?php
    207 } ?>
    208 </div>
    209 </div>
    210 
     210}
     211?>
     212</div>
     213</div>
     214<?php } ?>
     215
     216<?php if ( post_type_supports($post_type, 'editor') ) { ?>
    211217<div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
    212218
     
    240246
    241247<?php
     248}
    242249
    243250do_meta_boxes($post_type, 'normal', $post);
Note: See TracChangeset for help on using the changeset viewer.