I am using WordPress Multisite:
Main site
--sub site
--sub site
What i need to anything publish to sub sites will auto publish on the Main site
Regards
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityYou can use the switch_to_blog()
function. Whatever you call within the function would be just like you are pulling in any content, but from that particular blog ID.
I've had good luck using this WP_Query_Multisite
class on GitHub. It works just like WP_Query
and has some additional arguments to restrict certain sites.
The ThreeWP Broadcast plugin allows you to cross publish posts, pages, and custom post types from your sub sites to the main site: http://wordpress.org/plugins/threewp-broadcast/
Someone else is due credit for this function. I can't recall where I found it.
If that guys gets here, thank you!
You need to:
Step 1 - Include / embed this function in your functions.php:
(I tried to paste it here but its too long...)
Step 2 - Embed the function in your index.php file:
<?php if (is_home()) {
echo '<h1 class="homeTitle">'.esc_html__('New on My Blog Network', 'your_text_domain').'</h1>';
echo '<ul class="recentPostsGlobal">';
network_latest_posts($how_many=50, $how_long=0, $titleOnly=true, $begin_wrap="\n<li>", $end_wrap="</li>", $blog_id='null', $thumbnail=false, $cpt="post", $ignore_blog='null', $cat='null', $tag='null', $paginate=false, $excerpt_length='null', $display_root=false);
echo '</ul>';
}
?>
You can define the amount of posts you would like to return and other stuff.
So... hope this helps ;) Cheers, Sagive
There is a very good plugin for this called WordPress MU Sitewide Tags by @donncha
You have the controls to:
- copy all content from sub-sites to parent blog
- copy all content from sub-sites to a trending blog
- excludes pages from being copied
- exclude blogs marked private
- copy custom post meta fields
There are also a few widgets and supporting plugins from people like @andrea-r and ron who do quite a bit of work on the WordPress.Org forums > Multisite.
You can see this plugin in action at http://wordpress.damien.co and then visit my parent site at http://damien.co