I want create "Custom Post Type" that will have next structure:
Post (hierarhy level)-(some-post-id)
Post 1-1 =>
Post 2-2 Post 2-3 Post 2-4 => Post 3-5 Post 3-6 Post 3-7 Post 2-8 Post 2-9 Post 2-10
I need something like "Page attributes":
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityI want create "Custom Post Type" that will have next structure:
Post (hierarhy level)-(some-post-id)
Post 1-1 =>
Post 2-2 Post 2-3 Post 2-4 => Post 3-5 Post 3-6 Post 3-7 Post 2-8 Post 2-9 Post 2-10
I need something like "Page attributes":
You can set a post type to hierarchical when you register it with register_post_type
. Simply set the 'hierarchical' argument to true.
$args = array(
'public' => true,
'publicly_queryable' => true,
'has_archive' => true,
'rewrite' => true,
...
'hierarchical' => true,
...
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments','page-attributes' )
);
register_post_type('my-cpt',$args);