I would like to display content from across the network

I would like to display content from across the network on the main site:

1. List all the categories from across the network on the homepage.
2. List the business listings from across the network.
3. List the reviews/comments from across the network
4. List activity from across the network.

Please advice which plugin can be used for the same. And if a plugin is not available is there a short code that can be used for the same.

Thanks and Regards,
Alagiri

  • Ash

    Hello @alagiri_rajesh

    Welcome to WPMU community!

    I hope you are well today and thanks for asking the question.

    I am not aware of any plugin that does these jobs. This will need a fair amount of custom code. You can post a job in our job board where you can hire a developer to assist further: https://premium.wpmudev.org/wpmu-jobs/ Please note that, no WPMU official staffs are allowed to work in the job board.

    But let me give you an idea.

    You can use our post indexer plugin: https://premium.wpmudev.org/project/post-indexer/
    This plugin will take all posts in your network and save it into a separate table. Then you need to run query to fetch the posts. Post indexer has it's own custom functions those are very similar to wordpress core functions.

    For example, network_query is similar to wp_query.

    To fetch posts from that you can check out network theme: https://premium.wpmudev.org/project/network-theme/
    This theme shows a posts from every site in the network.

    Currently Post Indexer plugin fetch only posts by default, to add more post types you need to go to Network Admin > Dashboard > Settings > Post Indexer > Global Settings and add more post types in there.

    Hope it helps :slight_smile: Please feel free to ask more question if you have.

    Cheers
    Ash

  • dialmint

    Hi @Ashok,

    Let me be a little more elaborate. Where i did find solution for some of the questions. Just need a plugin or a hack that can be done. As I see that this is possible with the marketpress plugin. Where a Global Category can be set for across the network. It is shown in the link below:
    https://premium.wpmudev.org/forums/topic/global-product-categories-solved-a-tutorial

    Also can you please let me know if this is possible without customization.

    1. The categories from across the network are all same. What i would like to do is to display the categories w/o sub categories on the main site which will link to the global listing page with all businesses across the network under that category.

    Also if possible would like to show the same categories on the home page of the subsite, but just that here the categories will link to the category listing page which will show all businesses from the local sub site.

    The categories are all exactly the same as follows:

    For site-1

    Category1
    Category2

    For site-2

    Category1
    Category2

    For site-n

    Category1
    Category2

    2. Main-Site Home Page - List the top/recently added business listing from across the network.

    Sub-Site Home Page - List the top/recently added business listing from only the sub-site.

    I think the "Recent Global Posts" plugin should do this for the main site. But if i need to show the top(most viewed/most reviewed) is there any plugin for this.

    Also is there something similar to show only sub-sites data.

    3. Main-Site Home Page - List the top/recently added reviews/comments from across the network.

    Sub-Site Home Page - List the top/recently added reviews/comments from only the sub-site.

    I see a widget for this but if i am to use it in the content area how to do go about doing this for the mainsite homepage.

    Also is there a similar way to do it for the sub-site reviews/comments as well?

    4. Main-Site Home Page - List multiple activities from across the network.

    Sub-Site Home Page - List multiple activities from the sub site only.

    Thanks and Regards,
    Alagiri

  • Ash

    Hello @alagiri_rajesh

    I hope you are well today.

    #1: You can use the following code to have same categories in all sites:

    add_action( 'created_listing_category', 'created_listing_category_cb', 99, 2 );
    function created_listing_category_cb( $term_id, $tt_id ){
        if( get_current_blog_id() == 1 ){
            $term = get_term( $term_id, 'listing_category' );
            $blogs = wp_get_sites();
            foreach( $blogs as $blog ){
                if( $blog['blog_id'] != 1 ){
                    switch_to_blog( $blog['blog_id'] );
                    wp_insert_term( $term->name, 'listing_category',  array(
                        'slug' => $term->slug,
                        'description' => $term->description
                    ));
                    restore_current_blog();
                }
            }
        }
    }

    You can add those codes in your functions.php in the theme, if you think your theme won’t be changed. Otherwise mu-plugins is the best solution. To use mu-plugins, go to /wp-content/ and find the folder with name 'mu-plugins'. If there is no folder in that name, then create a folder, name it 'mu-plugins', create a file inside that, give any name you like and paste the code in there. You don't need to activate that plugin. Mu-plugins means must use plugins, so it will be activated automatically always. If you use mu-plugins then add a php start tag at the beginning of the code.

    Also if possible would like to show the same categories on the home page of the subsite, but just that here the categories will link to the category listing page which will show all businesses from the local sub site.

    I am not aware of any plugin that will do this job, you have to develop it custom.

    #2: Recent global posts will show the recent posts across the network, but this is not possible top reviews across the network.

    #3 & #4: I can't find any plugin to do this job, there are lots of variations in your requirement and I think you won't get any plugin for this :slight_frown: You need to consider it for custom development.

    Cheers
    Ash

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.