I’ve been trying to figure out how to build an effective directory of blogs hosted by a WPMU service. There’s the list-all mu-plugin widget, and it has a handy dandy list_all_wpmu_blogs()
method. I’ve created a page template for my theme, and added this code to dump the list of public blogs:
<!-- directory stuff goes here -->
<ul>
<?php list_all_wpmu_blogs("","","<li>","</li>","updated"); ?>
</ul>
<!-- end of directory stuff -->
Create a new Page, call it something creative like “Directory” and select the template that contains the above code. That works, technically, but doesn’t produce the most effective directory once the service grows to more than a dozen or so blogs.
But, once a service gets a bunch of blogs, say a hundred or so, a directory needs to be a bit more powerful. Sorting. Filtering. Searching. Categorizing. Letting people find blogs by activity (number of posts, number of comments, number of recent posts…) At the bare minimum, it’d be something like the great directories used by UMass and UTA. I haven’t been able to find out any detailed technical information about how either of those directories are built, but they appear to be static HTML files, probably generated by a separate script triggered by a cron job. They appear to run external to WordPress, but I could be wrong on that.
It should be relatively straightforward to build a WPMU blogs directory function, with the wp_blogs
table containing basic metadata about each blog, and info about the owner and last post just a join away. Anyone have any cool code to share? Any ideas of how best to implement this?