WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/04/2010 04:58:43 PM (10 years ago)
Author:
ryan
Message:

More custom post type support. Props scribu. see #9674

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/post-new.php

    r12065 r12597  
    99/** Load WordPress Administration Bootstrap */
    1010require_once('admin.php');
    11 $title = __('Add New Post');
    12 $parent_file = 'edit.php';
     11
     12if ( isset($_GET['post_type']) && in_array( $_GET['post_type'], get_post_types( array('_show' => true) ) ) )
     13    $post_type = $_GET['post_type'];
     14else
     15    $post_type = 'post';
     16
     17if ( 'post' != $post_type ) {
     18    $parent_file = "edit.php?post_type=$post_type";
     19    $submenu_file = "post-new.php?post_type=$post_type";
     20} else {
     21    $parent_file = 'edit.php';
     22    $submenu_file = 'post-new.php';
     23}
     24
     25$post_type_object = get_post_type_object($post_type);
     26
     27$title = sprintf(__('Add New %s'), $post_type_object->label);
     28
    1329$editing = true;
    1430wp_enqueue_script('autosave');
     
    3551// Show post form.
    3652$post = get_default_post_to_edit();
     53$post->post_type = $post_type;
    3754include('edit-form-advanced.php');
    3855
Note: See TracChangeset for help on using the changeset viewer.