The MU forums have moved to WordPress.org

Looping through all wpmu blog posts (12 posts)

  1. philroc2
    Member
    Posted 13 years ago #

    Hello,

    I would like like to display the ten latest posts of all blogs in my wpmu server, on the server's homepage.

    Is there any kind of wpmu.allblogs.have_posts() function?

    Must you use SQL to retrieve all posts?

    Many thanks.

    pr

  2. philroc2
    Member
    Posted 13 years ago #

    I found the solution:

    $blog_list = get_blog_list( 0, 'all' );
    foreach ($blog_list AS $blog) {
    $blog_id = $blog['blog_id'];
    $blog_path = $blog['path'];
    $post_count = get_blog_details($blog_id)->post_count;
    echo "Blog $blog_path has $post_count posts:
    \n";
    for ($i = 1; $i < $post_count + 1; ++$i) {
    echo "Post $i has title: " . get_blog_post($blog_id, $i)->post_title . "</br>";
    }
    }

  3. andrea_r
    Moderator
    Posted 13 years ago #

    that's going to be really heavy after a few blogs. Most of us use this:
    http://wordpress.org/extend/plugins/wordpress-mu-sitewide-tags/

    and tell it to pump all posts to the main blog.

  4. philroc2
    Member
    Posted 13 years ago #

    Many thanks Andrea

  5. WhiteJV
    Member
    Posted 13 years ago #

    I would like to do something similar. I'm currently using sitewide tags and it's working as intended, but for a final design I have something in mind that's quite a bit different than the functionality of sitewide tags.

    As I create new blogs for different family member households, I want to loop through the most recent posts of each given blog. I'm sure this would be quite easy, but I haven't gotten past the initial steps of designing this. I guess what I'll probably end up doing is creating a section for each blog similar to many of the magazine layouts, then loop through the most recent posts of a given blog by its blog_id. Does anyone know of a plugin that currently does such a thing?

  6. andrea_r
    Moderator
    Posted 13 years ago #

    Like this?

    http://atypicalife.net

    I modded one of the most recent posts plugins out there. I need to clean this up though.

  7. WhiteJV
    Member
    Posted 13 years ago #

    That would work. I could modify it and style it to my theme. I'm thinking of doing something like CNN.com (first place that came to mind) where it has different categories and most recent stories in that category below. In place of the category would be a link to the blog with the blog name (much the way yours is currently).

    I found this plugin as well, http://wpmudevorg.wordpress.com/project/Ada-A-Blog-Recent-Posts-Widget, but it's not giving me much love apparently. It will only give me the most recent post of the given blog, rather than the most recent 5 or 10 from the configuration. None of the other settings are working either (word limit, etc.). It also doesn't link to the blog from which it is pulling; it only links to the stories. If the rest of the stuff worked I could probably add in a little more functionality, but I'm not that good to fix the whole plugin. :-)

  8. WhiteJV
    Member
    Posted 13 years ago #

    Methinks I have a brilliant idea, though I'm not sure it will work.

    I just noticed that the Sitewide Tags plugin apparently appends some metadata onto each blog post with a blogid field and the permalink. Could I create a loop to read through my main blog's database to display only the most recent 5 posts from each blogid stored in the metadata?

    My concern with using sitewide tags was the potential for database bloat. I know my wife and I will be posting to our blog A LOT (we never shut up), though I'm not sure about my other family members. Is there also a way to remove anything beyond the 10 most recent posts from the main blog page or will the size of this database not really matter all that much?

    I really appreciate any feedback on this. I've been dying to get this project off the ground for about a month. Also, I believe you are the author of the Sitewide Tags plugin, correct Andrea? If so, well done! If not, thanks anyway for recommending this plugin to many people. Seeing you mention it so many times made me finally check it out. I guess I'm stubborn and took me hearing about it a few times.

  9. andrea_r
    Moderator
    Posted 13 years ago #

    or will the size of this database not really matter all that much?

    Nope, not really. I mean, it will get bigger than a single install, but usually when people in this forum talk about db bloat, we mean hundreds of thousands. :)

    Not the author of SWT, but highly involved. :D It's one of my faves and the boys usually leave the documentation of it to me.

  10. WhiteJV
    Member
    Posted 13 years ago #

    I just got done modifying http://wordpress.org/extend/plugins/advanced-most-recent-posts/. I still need to do some clean-up, but I have it up and running at whitefamily.byethost2.com.

    Now I just need to make the homepage that's in my head and get it all styled up nice and neat.

    Since bloat won't be a problem with the number of posts/blogs I'm expecting, I guess an advantage of having all the posts on my main blog is that I could search, basically, all the sub blogs from the main page, right? Will the permalink stick on the search results so that it will direct the user to the original post/blog?

  11. andrea_r
    Moderator
    Posted 13 years ago #

    Yes & yes. :)

  12. skcsknathan001
    Member
    Posted 13 years ago #

    This question comes up a lot of time.

    If you don't mind having an RSS, then you can use this plugin

    http://1uthavi.adadaa.com/ada-wpmu-sitewide-feed-plugin/

    This plugin gives a new RSS feed for entire posts/pages/comments [separate feeds] for all your WPMU blogs.

    Having it as an RSS feed is not a disadvantage, as I see it. You can actually allow users to subscribe, and you can use the feed url with a RSS Widget in your Appearance=>Widgets section to display latest posts/pages/comments in any sidebar! All you have to do is drag the RSS Widget to your sidebar area and set the feed url to the sitewide RSS feed url that was created by the plugin.

    You can see it in my site.
    http://adadaa.com/

About this Topic

  • Started 13 years ago by philroc2
  • Latest reply from skcsknathan001