Sillybean
Recent Posts with Excerpts
A widget that lists your most recent posts with excerpts, optionally limited to a category. The number of posts and excerpts is configurable; for example, you could show five posts but include the excerpt for only the most recent. Supports the_excerpt Reloaded and Advanced Excerpt.


46 comments
Sharing this post? The short URL is http://sillybean.net/?p=2308




Works great, thank you
Just wanted to say “thanks” for this widget! It works beautifully in conjunction with “Thumbnail for Excerpts” (though I’d love to see thumbnail support here too).
One issue: for whatever reason, changes to the “more…” link text are not taking. They’re saving in the widget interface, but not displayed on screen.
Wow, thanks for reporting that — really stupid error on my part. Fixed! Version 1.11 should show up in WordPress Extend in the next half hour or so.
Hey
it’s me from wp forum
have you notice my following reply
or if you want me to post it here let me know
I had not checked the forum yet this morning. Replying there, thanks.
wow.. great plugin.. thanks for sharing
Beautiful, elegant, perfect!
Thank you.
Thanks for the plugin! Changes to the more link does not work though. You said you fixed and uploaded it, however the new version is not there yet… Can you share the fix here? Thanks!
Sorry about that! It’s there under “Other Versions” — 1.11 is the one you want. It’ll be the current one sometime in the next fifteen minutes.
Nice work – best I’ve come across so far with simplicity. I am using the recent posts as a way to show upcoming events. I’d love the events to appear by descending date rather than the as written ascending order. Any easy way I can hard code the change?
Sure! Change line 67 to:
$q = ’showposts=’.$instance['numposts'].’&order=desc’;
I’m not sure that will get the next upcoming events, though — it might get the ones farthest in the future. You might also have to play around with the date range options for query_posts.
@ztruk: Not to take away from this plugin, but have you looked at the “Event Calendar” plugin? It adds event date/time custom fields to your posts and includes a widget for displaying those in “event order” rather than published date.
I should mention that I’ve just updated the widget to 2.0. It’s not that much of a feature upgrade, but apparently I was doing the version numbering wrong, so I’m just jumping way ahead to get around the problem. ztruk, your change occurs in the same place in the new version.
The Event Calendar plugin hasn’t been updated to work with 2.8 yet. It also inserts its content via Javascript, which I find annoying and pointless. Sadly, I don’t know of a better alternative, although I’ve tried half a dozen event plugins in the last month or so.
Actually, I looked into Events Calendar a few weeks back, but I wanted something that would display the event rather have to look for it. Don’t get me wrong, it has its good uses that I will probably take advantage of when they update its compatibility with 2.8.
Stephanie, I’ll give your code a try and let you know how it goes. Thanks for the quick reply!
A request to consider: can we get CSS classes on each different section of the excerpt? E.g., I want to style the post title, but it’s a generic ‘a’ before the blockquote. But applying CSS to the title ‘a’ also effects the ‘more’ text, which I don’t want.
Good idea, yes!
Thanks so much for adding the category selector – that’s very helpful. I’m wondering if you could also think about adding the ability to exclude a specific category? For example, I’m using a category to designate some posts as “events” — it would be nice to not show those in my recent posts/excerpts area of the home page.
P.S. back on the events topic, I’ve found a plugin called “Events” by Arnan de Gans that works very well for simple event integration with a blogsite. And no Javascript as far as I can tell.
Is there a shortcode for this plugin? I was checking out some of the other plugins in the competition and am hoping that I could use this one via shortcode in the Section Widget plugin.
Both good ideas, thanks! I’ll put them on the list for the next version. (There is no shortcode right now.)
Love this plugin!
Please add the ability to display pages also :)
Stephan, will the Post and Page Excerpt widget do what you need?
Hi Stephanie,
It certainly would if it had the ability to pull a random number of page excerpts that were limited to only sub pages of a page. Or instead had the ability to exclude pages.
There does not seem to be a whole lot of page related plugins for wordpress which is certainly understandable since it’s all focused around posts to begin with.
Stephanie,
Is it possible to do this very thing in a static page instead of a widget? I’ve seen a ton of people looking for this option, but nothing is out there that I have found.
I’ve found plugins that show a list of recent post links, but nothing that shows x number of excerpts like your widget plugin.
Any consideration of this would be mucho appreciated!
blessings,
Eric
Right now it’s just a widget, but I’ll see about adding a shortcode and a template function in the next version.
LOVE your plugin. Am wondering how to shorten the excerpts though. Changed the default word count line in the PHP from 55 to 20 but it doesn’t show through. There is no option to change in the interface that I can see.
This is almost exactly what I was looking for. All I needed to add was an option to display the dates of the recent posts listed and it was perfect. Maybe something to add in to future versions?
All-in-all though, brilliant. Thank you so much!
@Terri – I tried that too but it didn’t work. This is what you are looking for http://www.lancelhoff.com/change-the-excerpt-length-wordpress/
Terri and Owen: if you have the_excerpt Reloaded installed, you’ll get an option on the widget to change the word limit. Otherwise it uses the WP default (which Owen’s link shows you how to change).
Owen, I’ll add the dates in the next version. Thanks for the suggestion!
Very nice widget!
One request: when selecting the option to “Link widget title to blog home page”, I would like to be able to choose where it links to; if I selected the option to display certain categories, I’d like it to jump to that category page.
Cheers!
Good point, Matthew. I’ll add that in the next version.
@ Matthew: I am looking for something along these lines as well. I would like the title to link to one specific page that is not the home page regardless the post categories. Basically just the ability to set the link destination…
Great work, I love this widget!
is there a way to exclude the most recent post?
I realy like this plugin,
but got kind of a question. Is it posible to reverse the post.
On the project i am working on recently, its a website for friends of me who want to adopt a baby.
I have 2 categories. also 2 separate widgets.
One for blogging and one for the procedures they’ve had to take.
And its the procedure part that has to be reversed.
got any idea how to do this?
thanx in advance.
Thanks for a great plugin. The thing I like the most is using my own stylesheet instead of loading an extra.
I’ve found that links in the excerpt have the quotes (“) stripped from them making the code invalid. Links still work in FF, but haven’t tested it further yet.
Thanks again for a great plugin.
Please disregard my last post.
The culprit wasn’t this plugin, but the “Thumbnails for Excerpts” plugin.
The quotes (“) had already been stripped before this plugin got the excerpt.
Thanks
This plugin is excellent! However, I have been validating my site with your widget running and you are missing </li&rt; tags for your lists. It is a simple fix but without it sites cannot validate.
Hey, I love the plugin, its working great on the main blog page.
I have one question, though.
I am building a website (html and CSS, not a wordpress site), and I have a need to show off “featured posts” on the website.
I’m not sure how to pull just the data from your widget and place it in a div on my site, and I’ve been searching, and looking through code to no avail.
Do you know of any simple ways of doing this? My PHP isn’t very good, and I’m in a bind to get this working as soon as possible.
Catching up on replies in reverse:
Wallace, there’s no good way to use a widget without the rest of the WP structure in place. I think you’d be better off looking for an RSS parser — SimplePie, if you want PHP, or you could find a javascript-based one — and using the site’s feed instead of the widget.
Ben, thanks for catching that. I’ll fix it in the next version.
DM, there is no fast and easy way to do that. I’ll play around with it and see if I can work it into a future release.
Theodore, no, not right now.
I entered. “Recent_with_excerpt them blockquote” in my CCS with some properties. Unfortunately I do not get any change. You have any suggestions?
Thanks
damn translator… I meant “.recent_with_excerpt li blockquote”
I solved by removing “Blockqote” in the PHP pages, but it would have been more elegant to change the CSS
Is there a way to limit the amount of words? Love a bit of help here
Currently it is sticking at 55, want to bring it down to about 15
Thanks dudes
You can use a plugin or the new filters in 2.9 that allow you to change the length. More details here.
On the question Posted by Matthew on September 14th, 2009 at 1:59 pm:
I wrote a workaround to insert a link to the category within the title of the widget, awaiting a new version of the widget
I wrote it in a few minutes then I recommend making a backup of the page before editing.
FIRST STEP
Search text:
echo $before_widget;
and just below write:
if ($instance ['cat']> 0)
$category_link .= get_category_link ($instance ['cat']);
else $category_link = get_permalink (get_option (‘home’));
SECOND STEP:
Search text
else $link = get_permalink (get_option (‘home’));
and replace it with
else $link =”.category_link;
Hey Stephan,
Thanks for the excellent plugin. While validating the HTML on my site, I noticed that the plug-in was giving rise to two valdiating issues. I managed to correct them but I thought that you might like to know so you could possibly correct this in the next version of the plugin.
The first issue relates to the incorrect closing of some tags outside the IF statement checking if “more_text” is empty. The original code is:
if (!empty($instance['more_text'])) { ?><p class="alignright"><small><a href="<?php the_permalink(); ?>"><?php echo $instance['more_text']; } ?></a></small></p>
I replaced it with the following code:
if (!empty($instance['more_text'])) { ?><p class="alignright"><small><a href="<?php the_permalink(); ?>"><?php echo $instance['more_text']; ?></a></small></p> <?php } ?>
Also, you have forgotten to close the tag at the end of the post loop for the widget. I rectified this by closing the tag right before the endwhile statement:
} ?>
</li> <?php
endwhile;
I hope this helps. It doesn’t actually break the plugin, but it might bring up some quirks on older browsers. Thanks for the plugin!
Cheers
I apologize profusely for mispelling your name and getting it totally wrong in the comment above :)