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.






Unreal, very nice and I’m sure it’ll be popular :)
Hi James, thanks. I actually just upgraded the plugin, adding gravatar support and also some better formatting (including capitalizing the first 5 words of thex excerpt). Should i do a new post for the updated version? or just amend this one?
OK, the new version is now posted at WPMUDEV: http://wpmudev.org/project/AHP-Recent-Posts-for-WPMU
how do i hack this plugin to show more than one post per blog? let´s say the last 10 posts…
thanks,
Morgan
hmm. will look into it;…
Hi azizhp!
did you had time to have a look into it?
thanks,
morgan
note, the plugin has been updated. Theres a new project page at wpmudev, here:
http://wpmudev.org/project/AHP-Sitewide-Recent-Posts-for-WPMU
morgan, i made a lot of changes to the plugin, but adding posts from all blogs is actually a pretty hard problem to solve. it will require a pretty drastic overhaul of te underlying queries. Havent really figured out an elegant way to do that without doing a fundamental rewrite. Its on my todo list, though.
i upload the plugin and i tried to install it but its gives me an error?
can you be more specific about the error?
NICE WORK AZIZ! great effort.. thank’s a lot :D
btw.. how to disable this? “1st five words of excerpt are capitalized for readability”?
is it possible to exclude particular category/tag?
@Aziz Poonawalla,
would it be possible just getting the MU Blognames and Avatars on the Frontpage?
any suggestions would be a great help.
thanks
indojepang/khan,
i am about to release a new version which will give you the functionality/customability you need, stay tuned
Hi I am getting an error too:
Parse error: syntax error, unexpected ‘>’ in /home/sites/oxford-novelists.org.uk/public_html/wp-content/themes/brown/recentposts.php on line 9
What am I doing wrong. I am not a coder or techie just a regular joe so please make it simple!!
I hope this isn’t a dumb question but when you click on gravatar it goes to domain.com/author/TEST but there is nothing there. How do I configure the author page. Also is there anyway I can use a bigger thumbnail picture?
This plugin seems so much better than the ones I have used in my blogs. Gotta try this one day and see if it fits to my needs. It’s always nice to have control over things that you haven’t had :)
Do you guys have a recommendation section, i’d like to suggest some stuff