Changeset 12751 for trunk/wp-includes/post.php
- Timestamp:
- 01/18/2010 11:44:51 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post.php
r12733 r12751 16 16 */ 17 17 function create_initial_post_types() { 18 register_post_type( 'post', array('label' => __('Posts'), 'exclude_from_search' => false, '_builtin' => true, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'post', 'hierarchical' => false) ); 19 register_post_type( 'page', array('label' => __('Pages'),'exclude_from_search' => false, '_builtin' => true, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'page', 'hierarchical' => true) ); 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 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') ); 24 25 register_post_status( 'publish', array('label' => _x('Published', 'post'), 'exclude_from_search' => false, '_builtin' => true, 'label_count' => _n_noop('Published <span class="count">(%s)</span>', 'Published <span class="count">(%s)</span>')) ); 26 register_post_status( 'future', array('label' => _x('Scheduled', 'post'), 'exclude_from_search' => false, '_builtin' => true, 'label_count' => _n_noop('Scheduled <span class="count">(%s)</span>', 'Scheduled <span class="count">(%s)</span>')) ); 27 register_post_status( 'draft', array('label' => _x('Draft', 'post'), 'exclude_from_search' => false, '_builtin' => true, 'label_count' => _n_noop('Draft <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>')) ); 28 register_post_status( 'private', array('label' => _x('Private', 'post'), 'exclude_from_search' => false, '_builtin' => true, 'label_count' => _n_noop('Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>')) ); 29 register_post_status( 'trash', array('label' => _x('Trash', 'post'), 'exclude_from_search' => false, '_builtin' => true, 'label_count' => _n_noop('Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>')) ); 18 register_post_type( 'post', array( 'label' => __('Posts'), 19 'exclude_from_search' => false, 20 '_builtin' => true, 21 '_edit_link' => 'post.php?post=%d', 22 'capability_type' => 'post', 23 'hierarchical' => false, 24 'supports' => array('post-thumbnails', 'excerpts', 'trackbacks', 'custom-fields', 'comments', 'revisions') 25 ) ); 26 27 register_post_type( 'page', array( 'label' => __('Pages'), 28 'exclude_from_search' => false, 29 '_builtin' => true, 30 '_edit_link' => 'post.php?post=%d', 31 'capability_type' => 'page', 32 'hierarchical' => true, 33 'supports' => array('post-thumbnails', 'page-attributes', 'custom-fields', 'comments', 'revisions') 34 ) ); 35 36 register_post_type( 'attachment', array('label' => __('Media'), 37 'exclude_from_search' => false, 38 '_builtin' => true, 39 '_edit_link' => 'media.php?attachment_id=%d', 40 'capability_type' => 'post', 41 'hierarchical' => false 42 ) ); 43 44 register_post_type( 'revision', array( 'label' => __('Revisions'), 45 'exclude_from_search' => true, 46 '_builtin' => true, 47 '_edit_link' => 'revision.php?revision=%d', 48 'capability_type' => 'post', 49 'hierarchical' => false 50 ) ); 51 52 register_post_status( 'publish', array( 'label' => _x('Published', 'post'), 53 'exclude_from_search' => false, 54 '_builtin' => true, 55 'label_count' => _n_noop('Published <span class="count">(%s)</span>', 'Published <span class="count">(%s)</span>') 56 ) ); 57 58 register_post_status( 'future', array( 'label' => _x('Scheduled', 'post'), 59 'exclude_from_search' => false, 60 '_builtin' => true, 61 'label_count' => _n_noop('Scheduled <span class="count">(%s)</span>', 'Scheduled <span class="count">(%s)</span>') 62 ) ); 63 64 register_post_status( 'draft', array( 'label' => _x('Draft', 'post'), 65 'exclude_from_search' => false, 66 '_builtin' => true, 67 'label_count' => _n_noop('Draft <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>') 68 ) ); 69 70 register_post_status( 'private', array( 'label' => _x('Private', 'post'), 71 'exclude_from_search' => false, 72 '_builtin' => true, 73 'label_count' => _n_noop('Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>') 74 ) ); 75 76 register_post_status( 'trash', array( 'label' => _x('Trash', 'post'), 77 'exclude_from_search' => false, 78 '_builtin' => true, 79 'label_count' => _n_noop('Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>') 80 ) ); 30 81 } 31 82 add_action( 'init', 'create_initial_post_types', 0 ); // highest priority … … 640 691 * capability_type - The post type to use for checking read, edit, and delete capabilities. Defaults to "post". 641 692 * hierarchical - Whether the post type is hierarchical. Defaults to false. 693 * supports - An alias for calling add_post_type_support() directly. See add_post_type_support() for Documentation. Defaults to none. 642 694 * 643 695 * @package WordPress … … 656 708 657 709 // Args prefixed with an underscore are reserved for internal use. 658 $defaults = array('label' => false, 'exclude_from_search' => true, '_builtin' => false, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'post', 'hierarchical' => false, 'public' => false, '_show' => false );710 $defaults = array('label' => false, 'exclude_from_search' => true, '_builtin' => false, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'post', 'hierarchical' => false, 'public' => false, '_show' => false, 'supports' => array()); 659 711 $args = wp_parse_args($args, $defaults); 660 712 $args = (object) $args; … … 676 728 if ( !$args->_builtin && $args->public ) 677 729 $args->_show = true; 730 731 if ( ! empty($args->supports) ) { 732 add_post_type_support($post_type, $args->supports); 733 unset($args->supports); 734 } 678 735 679 736 $wp_post_types[$post_type] = $args; … … 3941 3998 return; 3942 3999 3943 if ( ! in_array( $post['post_type'], array( 'post', 'page' )) )4000 if ( !post_type_supports($post['post_type'], 'revisions') ) 3944 4001 return; 3945 4002
Note: See TracChangeset
for help on using the changeset viewer.