• Resolved mumumu

    (@imamura4108)


    Hello!
    Thanks for the great plugin.
    I would like to use the hierarchy feature, but it doesn’t work.
    I have the hierarchy set to true, 2 posts, all published.
    However, the field to specify the parent page does not show up
    Is there anything else I need to set?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    That’s the minimum requirements I know of, so that’s a bit odd.

    First thing that comes to mind to check is if you changed the capability type away from post?

    Otherwise, if you could visit the Tools menu and paste over the blob of text on the right to me, I can review all the settings used for this post type in question.

    Thread Starter mumumu

    (@imamura4108)

    Thank you for your reply.

    Is this the text you need?

    The only thing I’ve changed in the configuration settings.
    is probably just “hierarchy”.

    function cptui_register_my_cpts_contents() {
    
    	/**
    	 * Post Type: contents.
    	 */
    
    	$labels = [
    		"name" => __( "contents", "astra" ),
    		"singular_name" => __( "content", "astra" ),
    	];
    
    	$args = [
    		"label" => __( "contents", "astra" ),
    		"labels" => $labels,
    		"description" => "For Members",
    		"public" => true,
    		"publicly_queryable" => true,
    		"show_ui" => true,
    		"show_in_rest" => true,
    		"rest_base" => "",
    		"rest_controller_class" => "WP_REST_Posts_Controller",
    		"has_archive" => false,
    		"show_in_menu" => true,
    		"show_in_nav_menus" => true,
    		"delete_with_user" => false,
    		"exclude_from_search" => true,
    		"capability_type" => "post",
    		"map_meta_cap" => true,
    		"hierarchical" => true,
    		"rewrite" => [ "slug" => "contents", "with_front" => true ],
    		"query_var" => true,
    		"supports" => [ "title", "editor", "thumbnail" ],
    		"show_in_graphql" => false,
    	];
    
    	register_post_type( "contents", $args );
    }
    
    add_action( 'init', 'cptui_register_my_cpts_contents' );
    
    Thread Starter mumumu

    (@imamura4108)

    I’ve added a whole new post type.
    The only change I made was to set “hierarchical” to “True”.

    I added two pages and set them all to “Public”.
    However, I cannot specify a parent page for either of the pages.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Aha, I forgot one other part. In the “Supports” section, make sure you add “Page Attributes”, so that that entire metabox shows up. That should get you the rest of the way here.

    Thread Starter mumumu

    (@imamura4108)

    It’s done!

    As you pointed out, I checked the “Page Attributes” checkbox in the “Supports” section of the settings page, and now it shows up.

    Thank you very much!

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Welcome.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Cannot specify a parent page’ is closed to new replies.