Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Alright, there's been numerous topics about this, but it doesn't seem to work for me.

I have one normal page, called "Resources". Then I have several Custom Post Types. One of wich is "Video's".

I want "Video's" to be a child page of "Resources". At the moment, I can both access the video's page by the URL: http://site.com/resources/videos AND http://site.com/videos (they both work).

My Videos CPT is as follows:

function register_custom_post_video() {

$labels = array(
    'name' => _x('Videos', 'videos'),
    'singular_name' => _x('Video', 'video'),
    'add_new' => _x('Add New Video', 'Video'),
    'add_new_item' => __('Add New Video'),
    'edit_item' => __('Edit Video'),
    'new_item' => __('New Video'),
    'view_item' => __('View Video'),
    'search_items' => __('Search Videos'),
    'not_found' =>  __('No Videos found'),
    'not_found_in_trash' => __('No Videos found in Trash'),
    'parent_item_colon' => ''
);

$args = array(
    'labels' => $labels,
    'public' => true,
    'publicly_queryable' => true,
    'show_ui' => true,
    'query_var' => true,
    'rewrite' => array('slug' => 'resources', 'with_front' => true),
    'capability_type' => 'page',
    'hierarchical' => true,
    'menu_position' => null,
    'supports' => array('title','editor','author','excerpt','page-attributes')
);

register_post_type( 'videos' , $args );
}
add_action('init', 'register_custom_post_video');

But the rewrite doesn't seem to work. Also, when I resave the permalinks settings, it doesn't work.

I use archive-videos.php as the page.

Also, according to a WP Tuts+ quicktip, the

Therefore, to make a hierarchical custom post type, you have to have the ‘page-attributes‘ set in the ‘supports‘ array and the ‘hierarchical‘ flag set to true. I hope this was helpful to you as well!

does not work either.

Am I doing something wrong?

share|improve this question
add comment

1 Answer

You need to add page-attributes to the supports array e.g.

        'supports' => array( 'title', 'editor', 'page-attributes'),

This then should give you the parent functionality

share|improve this answer
    
I updated my answer to what I have now, where can I set the parent page? I realy don't get it :p –  Don Munter Jul 16 '13 at 11:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.