TDD Recent Posts Wordpress Plugin
This is a very simple plugin that essentially mimics the effect of the “recent posts” widget included with Wordpress, but with the addition of a content preview. The plugin will, by default, display the name of the post (with a link), the date it was published, and a short bit of text from the post.
It strips out any HTML from the post before displaying it, so if you are looking to display images — try a different plugin. Perhaps in future releases this will get more customized.
There is a widget admin panel that allows changing of the title, the number of posts to display, and how many characters to use for the content preview.
Download Link
Download the most stable version from Wordpress.
The ubiquitous “starving coder” donate button.


[...] TDD Recent Posts [...]
[...] TDD Recent Posts is almost identical to the Recent Posts widget included with WordPress. It places a list of your posts, from most recent to older, with a link to them. But it also includes the date of the post and a short excerpt from the beginning of the post. You can change the length of the excerpt shown, and the number of posts shown, but that is about it for easily controled options. [...]
Its seems with the new TDD 1.1, its stopped the Length of the preview text option and is now defaulted to its own number regardless of change on my site, using wp 2.7.
@Rich. That’s not right
. The plugin doesn’t shorten the entry if the entry is an excerpt, but it sounds like you’re having a new issue with the update.
I’ll check it out and see what’s happening. No guarantee on how fast I’ll fix the problem though… you know how it is. Thanks for letting me know about the problem!
Ok thanks, it seems what ever number I place in the widget for “Length of the preview text” like 50, 10 etc its doesnt change it in the display…
Thanks for a great plugin.
Okay Rich, I just submitted a new version to the WP subversion repository.
I’m not sure why the length of preview text wasn’t changing for you, since it’s working on my install, but it’s most likely due to the length of sentences you write.
It sounds silly, but by default the plugin will attempt to truncate the post text to a period. I set the system to take the number of characters to truncate to and “look forward” for a period. If we looked backward there would be a high probability of truncating the entire preview text out. In short, the “number of characters” wasn’t an exact science.
In this new version there is an option to truncate to exactly the number of characters you specify as well as an option to include the hand-written excerpts.
Hopefully this makes the plugin work as expected for you.
[...] “Recent Posts” and low and behold a popular Recent Posts plugin pops up in the #1 spot. TDD Recent Posts — my plugin — now comes up in the 9th spot. Not [...]
This is a fantastic plugin that I have used on many sites. I now need to exclude posts from certain categories though. is this possible?
I’m looking for a “recent posts” plugin for a widgetized area on a page. I’ve tested your plugin and it’s working fine.
However, I wanted to know if you’re still thinking about including support for html and images in the excerpts – because that’s something that I would really like to see.
Something else that I’d find useful would be to allow for custom-styling of the … that are displayed where the excerpt is trunkated. It would be cool to be able to put in something like “Read the rest of this post here” with a link.
Hi, was just wondering how to make the date + exerpt link to the post as well. I’ve removed the title.. Its something around here:
//Output the title and link for each entry in the list$output .= $before . '' . $post_title . ''. $postdate ."";
But I cant seem to figure it out..
Great if you mailed me about it..
-stiiig(AT)gmail.com
The easiest way might be to delete the
[a href=""][/a]from the line you referenced above and add it into the$beforeand$aftervariables which can be found near the top on lines 20 and 21.Hello, I wanted to use the widget in more than one sidebar – can it be done (through the WP control panel)?
Hello Gary, The plugin isn’t set-up to allow multiple instances yet. Here’s a tutorial:
http://brainfart.com.ua/post/lesson-wordpress-multi-widgets/
I has had a go but to no luck.
On my blog, the bit under the Page title is aligned to the right hand side, I have tried aligning it to the left but come across major problems.
Do you have any ideas why or any tips.
Thanks very much for the plugin,
Ross
Try — in your stylesheet:
.tddrecentposts dd {
margin-left:0;
}
If that doesn’t do it for you, then there are some greater forces at work in your stylesheet. I’d be happy to look at them, but contact me for rates, etc.
is it possible to remove the date from the plugin as it shows in sidebar? or even change the formula of the date, cause it isn’t right-to-left languages friendly as it is now.
by the way, this plugin is great.
Hakeem. Thanks for the kind words about the plugin. Being my first the code isn’t all that great and it’s certainly not localized.
You’ll find the PHP date string on line 63 of output.php. You can either modify the date() function there, or skip to line 66 and delete the date references.
Tylor, to be exactly sure what must I erase to hide the date from the output..
Line 66:
[dd class="sidebardate"]'. $postdate ."[/dd]Or, simply add a class in your CSS:
.sidebardate {
display:none;
}
Is there a way to make sticky posts appear at the top of the recent posts plugin in the same way they appear at the top of a blog? My site is http://02d7575.netsolhost.com/cef/ and the “CEF Budget Response” post should be sticky (and thus I’d like it at the top of the “From the CEF Blog” box which uses TDD Recent Posts on the homepage). Thanks!
Hi Dan, thanks for giving the plugin a try. I really have no intention of developing the plugin further, but I’m sure it could be accomplished without too much work. Here’s a pretty good run-down of the code behind sticky posts: http://www.nathanrice.net/blog/definitive-sticky-posts-guide-for-wordpress-27/
This seems to be EXACTLY what I am looking for, save one little item. Is there any way to only display posts from certain categories and that is it? For instance, I wanted to use this to display “Recent News” for my business, but I have other posts in addition to that category. If I could narrow it down, this would be perfect!
On a side note, I do see that someone asked something similar to this (about excluding certain categories), but did not see a response. Thanks!
Mike
Mike (and Simon above, sorry!):
There isn’t an easy fix to make the plugin exclude certain categories. Perhaps this forum post on WordPress.org will help:
http://wordpress.org/support/topic/149149
The appropriate code starts on line 40 of output.php — it’s a big SQL query.
I really have no intention on developing the plugin further (unless paid, of course) — to be sure, it needs a complete rewrite under the new WP 2.8 plugin API.
YIKES! That is a big SQL call indeed. And the link you gave me sort of confused the matter more!
No worries though, It just so happened that your plug-in was set up EXACTLY like I wanted it to be, save the category part. That being said, since it is mostly done, I will see what I can do to create a call that only calls certain categories. If I succeed, I will pass it along to you in case you wish to add it to the plugin. Either way, your direction on where the appropriate code starts is better than nothing at all! Thanks again.
Hi, I have just installed your plugin and am very pleased with it – it complements perfectly my front page which displays only the current and previous posts. I also run a widget showing latest comments and wondered if there was any way I could incorporate – after the date say – the date and writer name of the latest comment for each post (and ideally even a tooltip showing the comment). This would give readers a complete and clear picture of all recent activity alongside the main post. Thanks anyway for an excellent widget.
Hi
I’d like to use your TDD Recent Posts but I have a problem with IE7.
You use dl tag inside li tag and my IE7 insert an empty line between the posts.
How can I avoid that? following code can demonstrate it in IE7.
Mozilla does not have that issue though.
Coffee
– black hot drink
– white cold drink
Coffee
– black hot drink
– white cold drink
put that code in http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_dd_test
for example and test it with IE
It doesn’t sound like it’s so much of an empty line as it is an added bit of margin or padding to the li tag. Your theme should be using something of a reset stylesheet. If not, you can try setting a css declaration:
.tddrecentposts li {margin:0; padding:0;}
See if that gets you closer and thanks for the comment, I hope the plugin works for you.
Hi there!
I like your plagin very much!
But I’d like to know is there a way to show only today’s posts?
Thanks for checking out the plugin Vitaliy. There is no built-in way to show only today’s posts, but if you are up for modifying the plugin source you may see how.
Thanks for the answer


My knowledge in programming is even worse than in English
It would be great if you include such an option in your next patch
how can i add to display the author?
i have tried adding the variable $author = get_author(), but get an undefined function error.
i am almost clueless to php sorry…
thanks!
Tom, This was my first plugin and rather poorly written so it uses a WordPress SQL query to get the post content instead of the typical WordPress loop.
get_the_author()andthe_author()are only accessible from within a regular WordPress Loop.The plugin would essentially need to be rewritten to include a regular loop (which I may get around to someday).
Thanks for giving it a try though.
I have an image with a caption. The plugin is not stripping the caption syntax so the excerpt shows ” [caption id=”attachment_302″ align= …” etc etc
Any advice on how to get it to ignore the caption tags?
Unfortunately, there is no easy way to modify the plugin to do this. Easiest way is to use a hand-crafted excerpt instead of letting it automatically create the excerpt from the content.