UPDATE: Due to seeming failure of compatibility with the latest versions of WPMU, WPMU Dev has replaced my plugin at their site with their own Recent Posts plugin, which requires their Post Indexer. There’s only an old version at WPMU.org of my plugin now. I am going to rewrite this plugin shortly.
Related: search on AHP at premium WPMU
Building on the venerable Recent Posts plugin by Ron and Andrea, I have created an extended version that offers a lot more user control over output, including gravatar support. The basic features are:
- excludes posts on main blog (blog ID = 1)
- excludes first posts (Hello, world) on user blogs (post ID = 1)
- option to show gravatar support (24px). Gravatar links to posts by user on their blog.
- option to show post excerpt. User can specify excerpt length with extra argument. Option to capitalize 1st five words of excerpt for readability.
- option to show post author name
- option to show post date
- option to show post comment count
- all dispay options can be selectively toggled on or off using a single bitmask parameter, permitting very flexible and customizable usage (256 possible configurations!)
- numerous other display and formatting options can be easily edited in source code using global vars
The argument list:
- $how_many: how many recent posts are being displayed
- $how_long: time frame to choose recent posts from (in days)
- $optmask: bitmask for various display options (default: 255)
- 1; // gravatar
- 2; // date
- 4; // author name
- 8; // comment count
- 16; // blog name
- 32; // post name
- 64; // post excerpt
- 128; // excerpt capitalization
- $exc_size: size of excerpt in words (default: 30)
- $begin_wrap: start html code (default: <li class=”ahp_recent-posts”>)
- $end_wrap: end html code to adapt to different themes (default: </li>)
To use the bitmask option, simply add the numeric codes for the display options you want together. For example, suppose you only want gravatar, post name, and date – then the bitmask would be 1+2+32 = 35. Using a bitmask in this way, you can turn on or off any combination of display options above, using only a single function argument.
The latest version of this plugin is at WPMUDEV with a more complete description, installation instructions, screenshot, and sample function call. You can see also see the plugin in action at Talk Islam, under the sidebar section titled “Recent Journals”.