How can i add Custom post type as a child to other Custom post type DashBoard

enter image description here

WordPress #WP_Dashboard #Customize_Dashboard

How can i add Custom post type as a child to other Custom post type ?

Example :

City is Custom Post Type

Area is Custom Post Type

when i enter to city from dashboard i see
all cities and when i enter to any city i must see the areas in this city
and when i enter to area it must take me to area edit

how can i make some thing like this ?

for more illustrator

I wanna Make some thing like this

and when i enter Aswan

and when i enter Nasr City i shall see the area details

this is photoshop images

for the coding

function City(){
    register_post_type('City', array(
        'supports'=>array(
            'title',
        ),
        'public'=>false,
        'show_ui' => true,
        'labels'=> array(
            'name'=>'City',
            'add_new_item'=>'Add New City',
            'edit_item'=>'Edit City',
            'all_items'=>'All Cities',
            'singular_name'=>'City',
        ),
        'menu_icon'=>'dashicons-location-alt'
    ));
}
function Area(){
    register_post_type('Area', array(
        'supports'=>array(
            'title',
        ),
        'public'=>false,
        'show_ui' => true,
        'labels'=> array(
            'name'=>'Area',
            'add_new_item'=>'Add New Area',
            'edit_item'=>'Edit Area',
            'all_items'=>'All Areas',
            'singular_name'=>'Area',
        ),
        'menu_icon'=>'dashicons-location-alt'
    ));
}

Read more here:: How can i add Custom post type as a child to other Custom post type DashBoard

Leave a Reply

Your email address will not be published. Required fields are marked *