$query = "SELECT ID, user_nicename from $wpdb->users WHERE ID != '1' ORDER BY RAND()";
$author_ids = $wpdb->get_results($query);
// Loop through each author
foreach($author_ids as $author) {
// Get user data
$auth = get_userdata($author->ID);
// Get link to author page
$user_link = get_author_posts_url($auth->ID);
// Get blog details for the authors primary blog ID
$blog_details = get_blog_details($auth->primary_blog);
$site_url = $blog_details->siteurl;
}
The code above grabs users, loops through them and gets blog details for each user. Each user has their own blog.
Now, this is great for making a page that displays a list of all blogs in a network. But how can I get a few recent posts from each blog as well?
I have searched all over and haven't come up with a worth-while solution.
It seems like a function to grab posts by blog id would be in order, but I don't think such a function exists within WordPress. Is writing a custom function my only option here?