networking - How can I display posts from the other sites in a WordPress multisite setup? -
i have small network of sites setup wordpress 3.0's multisite feature. create site pulls posts various other sites display. new 'hub' site seem own separate site user (with domain mapping), content coming posts other sites.
how can posts site in wordpress multisite setup? can query posts based on name of site? end result needs collection of posts different sites sorted date.
thanks help.
i had similar issue wanted posts 1 blog , display on other came following solution modify meet needs if needed
<?php global $switched; switch_to_blog(2); //switched 2 // latest post $latest_posts = get_posts('category=-3&numberposts=6&orderby=post_name&order=dsc'); $cnt =0;?> <ul> <?php foreach($latest_posts $post) : setup_postdata($post);?> <li> <a href="<?php echo get_page_link($post->id); ?>" title="<?php echo $post->post_title; ?>"><?php echo short_title('...', 7); ?></a> </li> <?php endforeach ; ?> <?php restore_current_blog(); //switched main site ?>
i'm limiting amount of words being out putted if not want feature simple use
$post->post_title;
hope helps.
Comments
Post a Comment