Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <h2>News + Videos</h2>
- <?php
- $original_blog_id = get_current_blog_id(); // get current blog
- $bids = array(1,2); // all the blog_id's to loop through EDIT
- $catid_videos = 3; // EDIT
- $catid_news = 2; // EDIT
- $cats = array(1 => $catid_videos, 2 => $catid_news); // setup a category for each blog EDIT
- foreach($bids as $bid):
- switch_to_blog($bid); //switched to blog with blog_id $bid
- // ... your code for each blog ...
- $posts = get_posts('&cat='.$cats[$bid].'&posts_per_page=10');
- echo "<ul> <strong>Items from blog_id=".$bid."</strong>";
- foreach($posts as $post){
- setup_postdata( $post );
- echo "<li>";
- the_title();
- echo "</li>";
- }
- echo "</ul><hr>";
- endforeach ;
- switch_to_blog( $original_blog_id ); //switched back to current blog
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement