wordpress - How to group elements in the adminpanel (custom type posts) -


good afternoon. prompt huk group admin dashboard submenu.

as looks now

enter image description here

as want looked

|cyprus (main)

|-->news (sub)

|-->cities (sub)

|-->villages (sub)

|-->stories (sub)

you can using show_in_menu paramiter when registering custom post type.

$args = array(   'public' => true,   'show_ui' => true,    'query_var' => true,   'rewrite' => true,   'capability_type' => 'post',   'hierarchical' => false,   'show_in_menu' => 'edit.php?post_type=a_master_post_type',   'menu_position' => 30,   'has_archive' => true );  register_post_type('your-post-type',$args); 

instead of using 1 post type page main link create new menu item , reference in each of post type's show_in_menu paramiter.

'show_in_menu' => 'your-custom-menu-slug.php' 

and create new menu item.

function add_your_menu() {   add_menu_page(      'multiple post types page',      'multiple post types',          'manage_options',      'your-custom-menu-slug.php',      'your_menu_function');     // add_submenu_page() if want subpages, not necessary } add_action('admin_menu', 'add_your_menu'); 

this information gathered experience , examples taken this question on wordpress stack exchange.


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -