Changeset 12682
- Timestamp:
- 01/10/2010 01:23:14 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-form-advanced.php
r12651 r12682 100 100 if ( is_object_in_taxonomy($post_type, 'category') ) 101 101 add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', $post_type, 'side', 'core'); 102 if ( current_theme_supports( 'post-thumbnails', $post_type ) )102 if ( current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports($post_type, 'post-thumbnails') ) 103 103 add_meta_box('postimagediv', __('Post Thumbnail'), 'post_thumbnail_meta_box', $post_type, 'side', 'low'); 104 add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $post_type, 'normal', 'core'); 105 add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', $post_type, 'normal', 'core'); 106 add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', $post_type, 'normal', 'core'); 104 if ( post_type_supports($post_type, 'excerpts') ) 105 add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $post_type, 'normal', 'core'); 106 if ( post_type_supports($post_type, 'trackbacks') ) 107 add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', $post_type, 'normal', 'core'); 108 if ( post_type_supports($post_type, 'custom-fields') ) 109 add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', $post_type, 'normal', 'core'); 107 110 do_action('dbx_post_advanced'); 108 add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', $post_type, 'normal', 'core'); 109 110 if ( 'publish' == $post->post_status || 'private' == $post->post_status ) 111 if ( post_type_supports($post_type, 'comments') ) 112 add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', $post_type, 'normal', 'core'); 113 114 if ( ('publish' == $post->post_status || 'private' == $post->post_status) && post_type_supports($post_type, 'comments') ) 111 115 add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', $post_type, 'normal', 'core'); 112 116 -
trunk/wp-admin/edit-page-form.php
r12651 r12682 76 76 require_once('includes/meta-boxes.php'); 77 77 78 $post_type = 'page'; 79 78 80 add_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', 'page', 'side', 'core'); 79 add_meta_box('pageparentdiv', __('Attributes'), 'page_attributes_meta_box', 'page', 'side', 'core'); 80 add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', 'page', 'normal', 'core'); 81 add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', 'page', 'normal', 'core'); 82 add_meta_box('slugdiv', __('Page Slug'), 'post_slug_meta_box', 'page', 'normal', 'core'); 83 if ( current_theme_supports( 'post-thumbnails', 'page' ) ) 84 add_meta_box('postimagediv', __('Page Image'), 'post_thumbnail_meta_box', 'page', 'side', 'low'); 81 82 if ( post_type_supports($post_type, 'page-attributes') ) 83 add_meta_box('pageparentdiv', __('Attributes'), 'page_attributes_meta_box', $post_type, 'side', 'core'); 84 if ( post_type_supports($post_type, 'custom-fields') ) 85 add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', $post_type, 'normal', 'core'); 86 if ( post_type_supports($post_type, 'comments') ) 87 add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', $post_type, 'normal', 'core'); 88 add_meta_box('slugdiv', __('Page Slug'), 'post_slug_meta_box', $post_type, 'normal', 'core'); 89 if ( current_theme_supports( 'post-thumbnails', 'page' ) && post_type_supports($post_type, 'post-thumbnails') ) 90 add_meta_box('postimagediv', __('Page Image'), 'post_thumbnail_meta_box', $post_type, 'side', 'low'); 85 91 86 92 $authors = get_editable_user_ids( $current_user->id, true, 'page' ); // TODO: ROLE SYSTEM … … 88 94 $authors[] = $post->post_author; 89 95 if ( $authors && count( $authors ) > 1 ) 90 add_meta_box('pageauthordiv', __('Page Author'), 'post_author_meta_box', 'page', 'normal', 'core');96 add_meta_box('pageauthordiv', __('Page Author'), 'post_author_meta_box', $post_type, 'normal', 'core'); 91 97 92 98 if ( 0 < $post_ID && wp_get_post_revisions( $post_ID ) ) 93 add_meta_box('revisionsdiv', __('Page Revisions'), 'post_revisions_meta_box', 'page', 'normal', 'core');94 95 do_action('do_meta_boxes', 'page', 'normal', $post);96 do_action('do_meta_boxes', 'page', 'advanced', $post);97 do_action('do_meta_boxes', 'page', 'side', $post);99 add_meta_box('revisionsdiv', __('Page Revisions'), 'post_revisions_meta_box', $post_type, 'normal', 'core'); 100 101 do_action('do_meta_boxes', $post_type, 'normal', $post); 102 do_action('do_meta_boxes', $post_type, 'advanced', $post); 103 do_action('do_meta_boxes', $post_type, 'side', $post); 98 104 99 105 require_once('admin-header.php'); … … 129 135 <?php 130 136 do_action('submitpage_box'); 131 $side_meta_boxes = do_meta_boxes( 'page', 'side', $post); ?>137 $side_meta_boxes = do_meta_boxes($post_type, 'side', $post); ?> 132 138 </div> 133 139 … … 179 185 180 186 <?php 181 do_meta_boxes( 'page', 'normal', $post);187 do_meta_boxes($post_type, 'normal', $post); 182 188 do_action('edit_page_form'); 183 do_meta_boxes( 'page', 'advanced', $post);189 do_meta_boxes($post_type, 'advanced', $post); 184 190 ?> 185 191 -
trunk/wp-includes/post.php
r12679 r12682 20 20 register_post_type( 'attachment', array('label' => __('Media'), 'exclude_from_search' => false, '_builtin' => true, '_edit_link' => 'media.php?attachment_id=%d', 'capability_type' => 'post', 'hierarchical' => false) ); 21 21 register_post_type( 'revision', array('label' => __('Revisions'),'exclude_from_search' => true, '_builtin' => true, '_edit_link' => 'revision.php?revision=%d', 'capability_type' => 'post', 'hierarchical' => false) ); 22 add_post_type_support('post', array('post-thumbnails', 'excerpts', 'trackbacks', 'custom-fields', 'comments') ); 23 add_post_type_support('page', array('post-thumbnails', 'page-attributes', 'custom-fields', 'comments') ); 22 24 } 23 25 add_action( 'init', 'create_initial_post_types', 0 ); // highest priority … … 560 562 561 563 return $args; 564 } 565 566 /** 567 * Register support of certain features for a post type. 568 * 569 * @since 3.0 570 * @param string $post_type The post type for which to add the feature 571 * @param string|array $feature the feature being added, can be an array of feature strings or a single string 572 */ 573 function add_post_type_support( $post_type, $feature ) { 574 global $_wp_post_type_features; 575 576 $features = (array) $feature; 577 foreach ($features as $feature) { 578 if ( func_num_args() == 2 ) 579 $_wp_post_type_features[$post_type][$feature] = true; 580 else 581 $_wp_post_type_features[$post_type][$feature] = array_slice( func_get_args(), 2 ); 582 } 583 } 584 585 /** 586 * Checks a post type's support for a given feature 587 * 588 * @since 3.0 589 * @param string $post_type The post type being checked 590 * @param string $feature the feature being checked 591 * @return boolean 592 */ 593 594 function post_type_supports( $post_type, $feature ) { 595 global $_wp_post_type_features; 596 597 if ( !isset( $_wp_post_type_features[$post_type][$feature] ) ) 598 return false; 599 600 // If no args passed then no extra checks need be performed 601 if ( func_num_args() <= 2 ) 602 return true; 603 604 // @todo Allow pluggable arg checking 605 //$args = array_slice( func_get_args(), 2 ); 606 607 return true; 562 608 } 563 609
Note: See TracChangeset
for help on using the changeset viewer.