I want to replace posts page with network posts page

Hello,

I would like to essentially replace my posts page with network-wide posts. My scenario is that I'm using a multisite installation as a promotional network for a production company and the films being produced. Individual films will have their own page/look/feel but I'd like the posts from those sites to all funnel to the main production company's posts page.

I enjoy the look and feel of my main production company's posts page and would basically like to replace the content with site-wide BLOG posts. I was wondering if a good route to take would be to make a custom post e.g. "network_posts" type that includes all of the network posts and essentially make page template copy of the posts page and change it so that it displays "network_posts" instead of posts from the main site.

Do you have any advice on this? Is this something that is possible? Am I over-simplifying things?

Thanks,

James

  • Vinod Dalvi

    Hi James,

    I hope you are well today.

    I think the simple way to achieve it is using our following Post Indexer plugin

    https://premium.wpmudev.org/project/post-indexer/#usage

    You can use any plugins listed on the following page that work together with Post Indexer.

    https://premium.wpmudev.org/project/post-indexer/#detail

    Alternatively you can create a custom page template and call the Post Indexer plugin functions to retrieve posts from all blogs in your network.

    Please advise if you have more questions.

    Best Regards,
    Vinod Dalvi

  • james

    Thanks for the reply!

    I've been trying to use your advice but I seem to be a little too unskilled to pull this off... I would like to use the latter option of creating a page template, I have my template created and am having a hard time wrapping my brain around exactly how to "call the Post Indexer plugin functions."

    Could you elaborate a little about how I might go about doing that? I've come close, I believe, but still can only call posts from my main site. I'm not sure what I'm missing... The post-indexer.php file actually just has a bunch of require_once statements. Which of these php files actually has the function/functions I'm looking for when making the post type be the network-wide posts?

    Thanks,

    James

  • Vinod Dalvi

    Hi James,

    Thank you for your reply.

    You have to call Network_Query class defined in the Post indexer plugin which works similar like WP_Query as described on the following page.

    http://codex.wordpress.org/Class_Reference/WP_Query

    The only difference between these two classes is WP_Query only queries the posts created in the current blog but Network_Query class can query all the posts created in all blog in your multistage network.

    You have to use the function network_query_posts as following which then calls the Network_Query class. Also you have to use custom functions( declared in the Post Indexer plugin ) like network_get_the_title in the loop instead of get_the_title as shown in the following code.

    $network_query = network_query_posts();
    
    if ( network_have_posts() ) :
    
    	while ( network_have_posts() ) :
    		network_the_post();
    
    			$post = network_get_post();
    			$the_permalink = network_get_permalink();
    			$the_title = network_get_the_title();
    			$the_content = network_get_the_content();
    	endwhile;
    
    endif;

    Not all functions of WP_Query available in the Network_Query class so you have to check whether the function available in the following Post Indexer plugin files.

    post-indexer/includes/functions.php
    post-indexer/classes/networkquery.php

    Best Regards,
    Vinod Dlavi

  • james

    Vinod,

    Sadly, as I feared and suspected, this is all a little over my head. I did spend several hours trying, though! It looks like I'm going to have to just use the widget/shortcode solution which is a bummer because it would be nice to use the masonry-style blog/index pages that my theme has instead of the lists that are generated by the plugins.

    The potential of having the posts indexed the way that WPMU does with the post indexer plugin is really exciting. Maybe there will be a plugin at some point that utilizes the network_query class in such a way that it could act like a custom post type and be used in a themes pre-built index pages.

    It was worth a try to find a solution that was within my skill level but it appears that nothing like that currently exists.

    Thanks for your time!

    James

  • james

    I came up with a solution that appears to be working for me... I guess the answer was staring me right in the face and you really answered it in your first post. Thanks for humoring me!

    All I did was use the network latest post widget on a cloned default page.php. The only change I made to the default page was to remove all styling on the main body div. I made those changes into a custom page type, inserted the network latest post widget into the main body of the page and set the widget to display in blocks. Now I have a masonry style news page that has network-wide content!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.