The MU forums have moved to WordPress.org

Grouping blogs together as a community (2 posts)

  1. mdgross
    Member
    Posted 14 years ago #

    I'm using a post aggregator (Donncha) so that I can display a list of posts on the homepage that will include every blog on the site. It is working great so far.

    Now I've been tasked with dividing the bloggers into three different groups: Public, VIP and Staff. We'd like to display three separate lists (in chronological order) for each group of blogs.

    I wasn't sure if there was an easy way to perform this query, but I had another idea...

    Before the posts are displayed I call the 100 most recent posts and divide them up using a loop.

    query_posts('showposts=100'); ?>
    while(have_posts()) {
    		the_post();
    		$blog_details = get_active_blog_for_user(get_the_author_ID());
    
    		if(in_array($blog_details->blog_id, $second_sphere_id_list))
    		{
    			$second_sphere_posts[] = $post;
    		}
    		else
    		{
    			$first_sphere_posts[]  = $post;
    		}
    	}

    My question is... after I've built these separate arrays of $post how do I load them so that I can use WP functions such as the_title() and the_excerpt()? I tried borrowing setup_postdata() from the_post() function but it didn't work...

    foreach ($second_sphere_posts as $current_post)
    	{
    		setup_postdata($current_post);
    		the_title();
    	}

    Is this impossible?

  2. andrea_r
    Moderator
    Posted 14 years ago #

    You're trying to group posts when you actually want to group the blogs themselves.

    Get this:
    http://wpmudevorg.wordpress.com/project/Blog-Topics

    Then the blog will be grouped. :) Then you'll have an easier time pulling the recent posts from each group.

    Or, alternatively, make each one post to a specific category to tag (in addition) and then with the sitewide tags, you'll be able to pull thsoe tags/cats and fake a group.

About this Topic

  • Started 14 years ago by mdgross
  • Latest reply from andrea_r