diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index 7d539ba615..abbfdc01cb 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -106,10 +106,10 @@ foreach ( get_object_taxonomies($post_type) as $tax_name ) { if ( post_type_supports($post_type, 'page-attributes') ) add_meta_box('pageparentdiv', __('Attributes'), 'page_attributes_meta_box', $post_type, 'side', 'core'); -if ( current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports($post_type, 'post-thumbnails') ) +if ( current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports($post_type, 'thumbnail') ) add_meta_box('postimagediv', __('Post Thumbnail'), 'post_thumbnail_meta_box', $post_type, 'side', 'low'); -if ( post_type_supports($post_type, 'excerpts') ) +if ( post_type_supports($post_type, 'excerpt') ) add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $post_type, 'normal', 'core'); if ( post_type_supports($post_type, 'trackbacks') ) @@ -128,11 +128,13 @@ if ( ('publish' == $post->post_status || 'private' == $post->post_status) && pos if ( !( 'pending' == $post->post_status && !current_user_can( $post_type_object->publish_cap ) ) ) add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', $post_type, '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', __('Author'), 'post_author_meta_box', $post_type, 'normal', 'core'); +if ( post_type_supports($post_type, 'author') ) { + $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', __('Author'), 'post_author_meta_box', $post_type, 'normal', 'core'); +} if ( post_type_supports($post_type, 'revisions') && 0 < $post_ID && wp_get_post_revisions( $post_ID ) ) add_meta_box('revisionsdiv', __('Revisions'), 'post_revisions_meta_box', $post_type, 'normal', 'core'); @@ -184,6 +186,7 @@ $side_meta_boxes = do_meta_boxes($post_type, 'side', $post);
+
@@ -198,16 +201,19 @@ if ( !empty($shortlink) ) if ( !( 'pending' == $post->post_status && !current_user_can( $post_type_object->publish_cap ) ) ) { ?>
-ID) && ! empty($sample_permalink_html) && 'auto-draft' != $post->post_status ) : - echo $sample_permalink_html; -endif; ?> + ID) && ! empty($sample_permalink_html) && 'auto-draft' != $post->post_status ) + echo $sample_permalink_html; + ?>
+} +?>
+ +
post_content); ?> @@ -239,6 +245,7 @@ wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
false, 'rewrite' => false, 'query_var' => false, - 'supports' => array('post-thumbnails', 'excerpts', 'trackbacks', 'custom-fields', 'comments', 'revisions') + 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions') ) ); register_post_type( 'page', array( 'label' => __('Pages'), @@ -38,7 +38,7 @@ function create_initial_post_types() { 'hierarchical' => true, 'rewrite' => false, 'query_var' => false, - 'supports' => array('post-thumbnails', 'page-attributes', 'custom-fields', 'comments', 'revisions') + 'supports' => array('title', 'editor', 'author', 'thumbnail', 'page-attributes', 'custom-fields', 'comments', 'revisions') ) ); register_post_type( 'attachment', array('label' => __('Media'), @@ -835,6 +835,9 @@ function register_post_type($post_type, $args = array()) { if ( ! empty($args->supports) ) { add_post_type_support($post_type, $args->supports); unset($args->supports); + } else { + // Add default features + add_post_type_support($post_type, array('title', 'editor')); } if ( false !== $args->query_var && !empty($wp) ) { @@ -886,6 +889,23 @@ function add_post_type_support( $post_type, $feature ) { } } +/** + * Remove support for a feature from a post type. + * + * @since 3.0 + * @param string $post_type The post type for which to remove the feature + * @param string $feature The feature being removed + */ +function remove_post_type_support( $post_type, $feature ) { + global $_wp_post_type_features; + + if ( !isset($_wp_post_type_features[$post_type]) ) + return; + + if ( isset($_wp_post_type_features[$post_type][$feature]) ) + unset($_wp_post_type_features[$post_type][$feature]); +} + /** * Checks a post type's support for a given feature *