Manage 2 custom post type on the same admin page

Hi !

As I've already tell you, I'm working hard on a SAAS with Wordpress Multisite.

I'm facing a difficult point here as I want to have the easiest admin.

Right now, I have 2 custom post types, let's say "Food" and "Drink".

Here is what I want :

1) One item in the admin menu which will be called "Menu"
2) When the user click on this "Menu" item, he will have the page to manage not one but two custom post types : "Food" and "Drink". Here's a screenshot...

Thanks a lot !

    Patrick

    Hi there @Noomia

    I hope you are well today!

    I'm not quite sure how to get things to display in distinct sections like your screenshot. However, I did find a handy bit of code that merges selected post types on the same screen and orders all by post date:
    http://wordpress.stackexchange.com/a/114797

    You would likely want to add that code to your own custom plugin, then upload and activate it on your site.

    I just tested it by merging both posts & pages on the edit screen for the posts, and it works just fine. Below is the full code I tested with.

    <?php
    /*
    Plugin Name: Merge post types on same admin screen
    */
    
    add_action( 'pre_get_posts', 'join_cpt_list_wspe_113808' );
    
    function join_cpt_list_wspe_113808( $query )
    {
        // If not backend, bail out
        if( !is_admin() )
            return $query;
    
        // Detect current page and list of CPTs to be shown in Dashboard > Posts > Edit screen
        global $pagenow;
        $cpts = array( 'post', 'page' );
    
        if( 'edit.php' == $pagenow && ( get_query_var('post_type') && 'post' == get_query_var('post_type') ) )
            $query->set( 'post_type', $cpts );
    
        return $query;
    }
    
    add_filter( 'manage_edit-post_columns', 'add_cpt_column_wspe_113808' );
    foreach( array( 'post', 'page' ) as $cpt )
        add_action( "manage_{$cpt}_posts_custom_column", 'show_cpt_column_wspe_113808', 10, 2 );
    
    function add_cpt_column_wspe_113808( $columns )
    {
        $columns[ 'cpt' ] = 'Post Type';
        return $columns;
    }
    
    function show_cpt_column_wspe_113808( $column_name, $post_id )
    {
        if ( 'cpt' != $column_name )
            return;
        echo get_post_type( $post_id );
    }
    
    ?>