]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-admin/post-new.php
WordPress 3.3.2
[autoinstalls/wordpress.git] / wp-admin / post-new.php
1 <?php
2 /**
3  * New Post Administration Screen.
4  *
5  * @package WordPress
6  * @subpackage Administration
7  */
8
9 /** Load WordPress Administration Bootstrap */
10 require_once('./admin.php');
11
12 if ( !isset($_GET['post_type']) )
13         $post_type = 'post';
14 elseif ( in_array( $_GET['post_type'], get_post_types( array('show_ui' => true ) ) ) )
15         $post_type = $_GET['post_type'];
16 else
17         wp_die( __('Invalid post type') );
18
19 $post_type_object = get_post_type_object( $post_type );
20
21 if ( 'post' == $post_type ) {
22         $parent_file = 'edit.php';
23         $submenu_file = 'post-new.php';
24 } else {
25         $submenu_file = "post-new.php?post_type=$post_type";
26         if ( isset( $post_type_object ) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true ) {
27                 $parent_file = $post_type_object->show_in_menu;
28                 if ( ! isset( $_registered_pages[ get_plugin_page_hookname( "post-new.php?post_type=$post_type", $post_type_object->show_in_menu ) ] ) )
29                         $submenu_file = $parent_file;
30         } else {
31                 $parent_file = "edit.php?post_type=$post_type";
32         }
33 }
34
35 $title = $post_type_object->labels->add_new_item;
36
37 $editing = true;
38
39 if ( ! current_user_can( $post_type_object->cap->edit_posts ) )
40         wp_die( __( 'Cheatin&#8217; uh?' ) );
41
42 wp_enqueue_script('autosave');
43
44 // Show post form.
45 $post = get_default_post_to_edit( $post_type, true );
46 $post_ID = $post->ID;
47 include('edit-form-advanced.php');
48 include('./admin-footer.php');
49 ?>