Question

I am working on a project where I need to add table for custom post type. Please see this image: http://puu.sh/bOvtP/401d0f2f46.png

I have picked up a half-done project, and the client is willing not to see the WP interface. So, they already have it customized to a vast extent.

I have successfully created the admin pages in the back-end for three different custom post, for all three of them I need to create the table as shown int the image above.

The fourth column in the table in the above image is for "Region", which is actually name of states(which are sub-sites in the Multi-site network), I don't know how will I know to which sub-site the custom post is posted in.

The images shows that this is like admin screen of a custom post. But, the client don't want to use the default display of post in List tables in WordPress.

My problem is that I am not able to get the "custom posts" at that screen, and don't know how will I identify to which sub-site the custom post is posted too?

Please, view and suggest something. Thanks.

Was it helpful?

Solution

It was resolved. This question was specific to some particular project and it's requirements. And, it was fulfilled at that time with a multisite function for WordPress.

What I did:

The task was done using a sub-class of WP_Query named WP_Query_Multisite. This class provides us arguments to use for which site to grab the info from.

What I used is:

    if( ($taxonomy != '') AND ( $taxonomy_term_slug != '' ) ) {
        $is_taxonomy_query = TRUE; 
        // This is a call with taxonomy so set those args
        $args = array( 
            'post_type'     => $post_type,
            'post_status'   => array( 'pending', 'draft', 'future' ),
            $taxonomy       => $taxonomy_term_slug
        );
    }
    else {
        $args = array( 
            'post_type'     => $post_type,
            'post_status'   => array( 'pending', 'draft', 'future' )
        );
    }

    // Run Our MultiSite Query 
    $query = new WP_Query_Multisite( $args ); 

And, then using the global variable blog_id in the loop:

    global $blog_id; 
    echo get_blog_details( $blog_id )->blogname;
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top