WordPress, Multisite and BuddyPress plugins, themes and support


Building on the venerable ah_recent_posts_mu plugin (Ron Rennick), I’ve put a version together that allows for a bit more flexible output and control. It’s a short plugin and not very complex, but it’s very flexible and extremely handy. The enhancements are as follows:

  • automatically exclude all posts from the main blog (ID = 1)
  • automatically exclude all “Hello World” posts on new blogs
  • three display options: 1. “title”: title only 2. “name”: blog name and title, and 3. “excerpt”: blog name, title and post excerpt. The excerpt defaults to 30 words but this can be changed by specifying an integer argument.
  • Gravatar support, post date, and post author (all optional and configurable)

Sample function call:

<?php ahp_recent_posts(5, 90, 30, ‘<li>’, ‘</li>’, 1); ?>

which would display the 5 most recent entries over the past 90 days, displaying titles, blog name, and 20-word excerpt.  The last argument is a bitmask, in this case showing just the gravatar, hiding the post date and author. A screenshot of the output for this function call is shown at right.

You can see also see the plugin in action at Talk Islam, under the sidebar section titled “Recent Journals”.

The latest version (0.5) of this plugin is at WPMUDEV with a more complete description and also the full argument list. Latest source code is also at pastebin here.

Post to Twitter Tweet This Post