• Resolved thebiganswer

    (@thebiganswer)


    Hi All,

    Some hints for anyone wondering why, when adding a new post for their own custom post type, there is no drop-down menu list on the right-hand side to elect another post to be its parent. In my experience (and there may well be other circumstances) the box will appear only…

    1. …when you have already added at least one post for the respective post type, and you are now adding a second/third/etc. NOTE: if you have already created at least one ‘normal’ post, and now you’re adding you first custom-type post (e.g. ‘Event’), know that a ‘normal’ post cannot be the parent of a custom-type post (and vice-versa).

    2. …when you have added the necessary support (i.e. the ‘page-attributes’ element in the array) in your theme functions.php file.

    E.g.

    add_action(‘init’, ‘create_my-custom-post-type’);

    function create_my-custom-post-type() {
    $my-custom-post-type_args = array(
    ..etc…
    ‘supports’ => array(‘title’, ‘editor’, ‘excerpt’, ‘page-attributes’)
    );
    register_post_type(‘my-custom-post-type’,$my-custom-post-type_args);
    }

    (There are myriad resources on functions.php if you need more in-depth guidance.)

    Hope this helps.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter thebiganswer

    (@thebiganswer)

    While I have it in mind, there is another solution which was posted elsewhere…

    3) …if you switch your theme to another theme, and then [immediately] change it back again, this has been noted to enable (i.e. make visible) the parent drop-down list.

    hi, tried adding custom post type with:

    add_action( 'init', 'create_events' );
    function create_events() {
      $labels = array(
        'name' => _x('Events', 'post type general name'),
        'singular_name' => _x('Event', 'post type singular name'),
        'add_new' => _x('Add New', 'Event'),
        'add_new_item' => __('Add New Event'),
        'edit_item' => __('Edit Event'),
        'new_item' => __('New Event'),
        'view_item' => __('View Event'),
        'search_items' => __('Search Events'),
        'not_found' =>  __('No Events found'),
        'not_found_in_trash' => __('No Events found in Trash'),
        'parent_item_colon' => ''
      );
    
      $supports = array('title', 'editor','excerpt', 'custom-fields','revisions','thumbnail','author','page-attributes');
    
      register_post_type( 'event',
        array(
          'labels' => $labels,
          'public' => true,
          'supports' => $supports
        )
      );
    }

    used page-attributes but no luck – parent dropdown not showing. Also tried theme switch to default and back, still nothing.

    What im missed? ??

    thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Solution to Custom Post Type Parent Drop Down Is Missing’ is closed to new replies.