Ticket #9674: 9674.11.diff
File 9674.11.diff, 4.3 KB (added by , 15 years ago) |
---|
-
wp-includes/post.php
19 19 register_post_type( 'page', array('label' => __('Pages'),'exclude_from_search' => false, '_builtin' => true, '_edit_link' => 'page.php?post=%d', 'capability_type' => 'page', 'hierarchical' => true) ); 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('thumbnails', 'excerpts', 'trackbacks', 'custom-fields', 'comments') ); 22 23 } 23 24 add_action( 'init', 'create_initial_post_types', 0 ); // highest priority 24 25 … … 562 563 } 563 564 564 565 /** 566 * Register support of certain features for a post type. 567 * 568 * @since 3.0 569 * @param string $post_type The post type for which to add the feature 570 * @param string|array $feature the feature being added, can be an array of feature strings or a single string 571 */ 572 function add_post_type_support( $post_type, $feature ) { 573 global $_wp_post_type_features; 574 575 $features = array($feature); 576 foreach ($features as $feature) { 577 if ( func_num_args() == 2 ) 578 $_wp_post_type_features[$post_type][$feature] = true; 579 else 580 $_wp_post_type_features[$post_type][$feature] = array_slice( func_get_args(), 2 ); 581 } 582 } 583 584 /** 585 * Checks a post type's support for a given feature 586 * 587 * @since 3.0 588 * @param string $post_type The post type being checked 589 * @param string $feature the feature being checked 590 * @return boolean 591 */ 592 593 function post_type_supports( $post_type, $feature ) { 594 global $_wp_post_type_features; 595 596 if ( !isset( $_wp_post_type_features[$post_type][$feature] ) ) 597 return false; 598 599 // If no args passed then no extra checks need be performed 600 if ( func_num_args() <= 2 ) 601 return true; 602 603 // @todo Allow pluggable arg checking 604 //$args = array_slice( func_get_args(), 2 ); 605 606 return true; 607 } 608 609 /** 565 610 * Updates the post type for the post ID. 566 611 * 567 612 * The page or post cache will be cleaned for the post ID. -
wp-admin/edit-form-advanced.php
101 101 add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', $post_type, 'side', 'core'); 102 102 if ( current_theme_supports( 'post-thumbnails', $post_type ) ) 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'); 111 if ( post_type_supports($post_type, 'comments') ) 112 add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', $post_type, 'normal', 'core'); 109 113 110 if ( 'publish' == $post->post_status || 'private' == $post->post_status)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 113 117 if ( !( 'pending' == $post->post_status && !current_user_can( 'publish_posts' ) ) )