18 | | register_post_type( 'post', array( 'label' => __('Posts'), |
19 | | 'singular_label' => __('Post'), |
20 | | 'public' => true, |
21 | | 'show_ui' => false, |
22 | | '_builtin' => true, |
23 | | '_edit_link' => 'post.php?post=%d', |
24 | | 'capability_type' => 'post', |
25 | | 'hierarchical' => false, |
26 | | 'rewrite' => false, |
27 | | 'query_var' => false, |
28 | | 'supports' => array('post-thumbnails', 'excerpts', 'trackbacks', 'custom-fields', 'comments', 'revisions') |
29 | | ) ); |
| 18 | $initial_post_types = apply_filters('initial_post_types',default_initial_post_types()); |
| 19 | foreach($initial_post_types as $post_type => $attributes) |
| 20 | register_post_type($post_type,$attributes); |
31 | | register_post_type( 'page', array( 'label' => __('Pages'), |
32 | | 'singular_label' => __('Page'), |
33 | | 'public' => true, |
34 | | 'show_ui' => false, |
35 | | '_builtin' => true, |
36 | | '_edit_link' => 'post.php?post=%d', |
37 | | 'capability_type' => 'page', |
38 | | 'hierarchical' => true, |
39 | | 'rewrite' => false, |
40 | | 'query_var' => false, |
41 | | 'supports' => array('post-thumbnails', 'page-attributes', 'custom-fields', 'comments', 'revisions') |
42 | | ) ); |
43 | | |
44 | | register_post_type( 'attachment', array('label' => __('Media'), |
45 | | 'public' => true, |
46 | | 'show_ui' => false, |
47 | | '_builtin' => true, |
48 | | '_edit_link' => 'media.php?attachment_id=%d', |
49 | | 'capability_type' => 'post', |
50 | | 'hierarchical' => false, |
51 | | 'rewrite' => false, |
52 | | 'query_var' => false, |
53 | | ) ); |
54 | | |
55 | | register_post_type( 'revision', array( 'label' => __('Revisions'), |
56 | | 'singular_label' => __('Revision'), |
57 | | 'public' => false, |
58 | | '_builtin' => true, |
59 | | '_edit_link' => 'revision.php?revision=%d', |
60 | | 'capability_type' => 'post', |
61 | | 'hierarchical' => false, |
62 | | 'rewrite' => false, |
63 | | 'query_var' => false, |
64 | | ) ); |
65 | | |
66 | | register_post_type( 'nav_menu_item', array( 'public' => false, |
67 | | 'show_ui' => false, |
68 | | '_builtin' => true, |
69 | | 'capability_type' => 'post', |
70 | | 'hierarchical' => false, |
71 | | 'rewrite' => false, |
72 | | 'query_var' => false, |
73 | | ) ); |
74 | | |
| 67 | function default_initial_post_types() { |
| 68 | $initial_post_types = array( |
| 69 | 'post' => array('label' => __('Posts'), |
| 70 | 'singular_label' => __('Post'), |
| 71 | 'public' => true, |
| 72 | 'show_ui' => false, |
| 73 | '_builtin' => true, |
| 74 | '_edit_link' => 'post.php?post=%d', |
| 75 | 'capability_type' => 'post', |
| 76 | 'hierarchical' => false, |
| 77 | 'rewrite' => false, |
| 78 | 'query_var' => false, |
| 79 | 'supports' => array('post-thumbnails', 'excerpts', 'trackbacks', 'custom-fields', 'comments', 'revisions') |
| 80 | ), |
| 81 | 'page' => array( 'label' => __('Pages'), |
| 82 | 'singular_label' => __('Page'), |
| 83 | 'public' => true, |
| 84 | 'show_ui' => false, |
| 85 | '_builtin' => true, |
| 86 | '_edit_link' => 'post.php?post=%d', |
| 87 | 'capability_type' => 'page', |
| 88 | 'hierarchical' => true, |
| 89 | 'rewrite' => false, |
| 90 | 'query_var' => false, |
| 91 | 'supports' => array('post-thumbnails', 'page-attributes', 'custom-fields', 'comments', 'revisions') |
| 92 | ), |
| 93 | 'attachment' => array('label' => __('Media'), |
| 94 | 'public' => true, |
| 95 | 'show_ui' => false, |
| 96 | '_builtin' => true, |
| 97 | '_edit_link' => 'media.php?attachment_id=%d', |
| 98 | 'capability_type' => 'post', |
| 99 | 'hierarchical' => false, |
| 100 | 'rewrite' => false, |
| 101 | 'query_var' => false, |
| 102 | ), |
| 103 | 'revision' => array('label' => __('Revisions'), |
| 104 | 'singular_label' => __('Revision'), |
| 105 | 'public' => false, |
| 106 | '_builtin' => true, |
| 107 | '_edit_link' => 'revision.php?revision=%d', |
| 108 | 'capability_type' => 'post', |
| 109 | 'hierarchical' => false, |
| 110 | 'rewrite' => false, |
| 111 | 'query_var' => false, |
| 112 | ), |
| 113 | 'nav_menu_item' => array( 'public' => false, |
| 114 | 'show_ui' => false, |
| 115 | '_builtin' => true, |
| 116 | 'capability_type' => 'post', |
| 117 | 'hierarchical' => false, |
| 118 | 'rewrite' => false, |
| 119 | 'query_var' => false, |
| 120 | ), |
| 121 | ); |
| 122 | return $initial_post_types; |
| 123 | } |
| 124 | |