Sillybean

Post and Page Excerpt Widgets

Creates widgets that display excerpts from posts or pages in the sidebar. You may use ‘more’ links and/or link the widget title to the post or page. Based on Milan Petrovic’s Multi Instance Widget. Requires Page Excerpt or Excerpt Editor for page excerpts. Supports the_excerpt Reloaded and Advanced Excerpt.

Download »

If you’d rather not use a widget, here’s the more or less equivalent code for your template (which does not require you to install this plugin).

For pages:

<?php
	// page title
	echo = '<a href="'.get_permalink($post->ID).'">'.the_title().'</a>'; 
	// custom Loop
	$page_query = new WP_Query('page_id='.$post->ID); 
	while ($page_query->have_posts()) : $page_query->the_post(); 
	// the excerpt of the page
	if (function_exists('the_excerpt_reloaded')) 
		the_excerpt_reloaded(100, '<p><div><span><br><img><a><ul><ol><li><blockquote><cite><em><i><strong><b><h2><h3><h4><h5><h6>', 'content', FALSE, '', '', '1', '');
	else the_excerpt(); // this covers Advanced Excerpt as well as the built-in one
	endwhile; // end custom Loop
?>

For posts, the query is slightly different:

<?php
	// page title
	echo = '<a href="'.get_permalink($post->ID).'">'.the_title().'</a>'; 
	// custom Loop
	$post_query = new WP_Query('p='.$post->ID); 
	while ($post_query->have_posts()) : $post_query->the_post(); 
	// the excerpt of the page
	if (function_exists('the_excerpt_reloaded')) 
		the_excerpt_reloaded(100, '<p><div><span><br><img><a><ul><ol><li><blockquote><cite><em><i><strong><b><h2><h3><h4><h5><h6>', 'content', FALSE, '', '', '1', '');
	else the_excerpt(); // this covers Advanced Excerpt as well as the built-in one
	endwhile; // end custom Loop
?>
20 comments

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

Comments

  1. Thanks for the plugin. It can be very usefull. But somehow it shows the excerpt and below full post. What can I do with that?

    Posted by Umesh on May 5th, 2009 at 5:03 am

  2. Thanks for the plugin! I need to include a page excerpt on a custom landing page and am wondering if there is a php function I can call instead of using the widget interface? I’m using Excerpt Editor to generate the page excerpt.

    Posted by ElShaddai Edwards on July 9th, 2009 at 7:35 am

  3. You’d use the_excerpt as usual, but you need to be inside a loop for the appropriate post/page ID, and in most cases that will mean adding a second loop to the template. I’ve edited the page to include the code that prints the title and excerpt inside a custom loop for both posts and pages.

    Posted by Stephanie on July 9th, 2009 at 9:54 am

  4. Is there any way for this plug-in to display the N most recent excerpts rather than a specific ID?

    I need to be able to display excerpts of the last 2 or 3 blog posts on a static page template (not single post or index), either by widget or code, and have not been able to find a way to do this.

    Posted by ElShaddai Edwards on July 22nd, 2009 at 2:55 pm

  5. This plugin doesn’t do that, but I have the code that does and will release it as a plugin later this week.

    Posted by Stephanie on July 22nd, 2009 at 3:28 pm

  6. Thanks for the reply – I found a serviceable solution for the time being, but will look forward to yours as well!

    Posted by ElShaddai Edwards on July 23rd, 2009 at 7:58 am

  7. OK, it’s not on WordPress Extend yet, but here it is:
    http://sillybean.net/code/wordpress/recent-posts-with-excerpts/

    Posted by Stephanie on July 24th, 2009 at 3:09 pm

  8. hey, good plugin. The page excerpt is not working properly on my blog (wp v2.8.3). The more.. link is not showing. It shows [..] instead and with no link to the page.

    Posted by baby blog on August 7th, 2009 at 8:46 am

  9. Have you upgraded to the latest version of the plugin? I fixed one problem with the more links. If you have, do you have any plugins (like the_excerpt reloaded, or advanced excerpt) that affect the excerpts?

    Posted by Stephanie on August 7th, 2009 at 11:06 am

  10. I am having the same problem as baby blog…more link not working.
    I have the most current Verizon of the plugin from wp extend…and am using wp v2.8.3.
    I have no other plugins that might affect excerpts. The more link was working fine before upgrade.

    Posted by Lynne on August 9th, 2009 at 3:28 pm

  11. just a heads up…based on firebug..it is not inserting the link…

    Posted by Lynne on August 9th, 2009 at 3:30 pm

  12. Is anyone else having issues with the link to title and the more links since upgrading to wp v2.8.3?

    My more link did not work…so I thought I would just link the title…but they don’t go to the right pages…

    Posted by Lynne on August 10th, 2009 at 11:17 am

  13. Lynne, can you post a link? I’d like to take a look at what’s going on.

    Posted by Stephanie on August 10th, 2009 at 11:29 am

  14. Version 2.1 is out now and should solve the problems Lynne and baby blog reported. Huge thanks to Lynne for helping me test this release!

    Posted by Stephanie on August 10th, 2009 at 4:35 pm

  15. Really useful plug in, especially in seo/sem cases when you need to optimize landing pages.

    I would like to show a thumbnail (that in my case is the post meta “thumb”) with the excerpt.

    Have you got an idea how to do that?

    Posted by bluantinoo on January 21st, 2010 at 12:08 pm

  16. bluantinoo, I’m planning to implement (optional) thumbnails using the new built-in the_post_thumbnail feature. It’ll be in a new version soonish.

    Posted by Stephanie on January 21st, 2010 at 3:22 pm

Trackbacks & Pingbacks

  1. Weblog Tools Collection » Blog Archive » WordPress Plugin Releases for 07/29
    July 29, 2008 at 4:30 pm

  2. A few cool new WP plug-ins - Netpond ?
    July 29, 2008 at 11:02 pm

  3. 12 New Plugins Set On 07/30 | Webabout.org
    July 31, 2008 at 10:26 am

  4. Leonaut.com
    August 10, 2008 at 6:49 pm

Leave a Reply

-- or --

Textile formatting is in effect.

RSS feed for comments on this post. TrackBack URI