Luca Biagini | Marketing, Adv, Communication & Webdesign

WordPress plugin: the excerpt re-reloaded
Published on November 29, 2008

UPDATED!
UPDATED AGAIN!

The fantastic plugin The Excerpt Reloaded by Kaf Oseo, my trusted companion in dozens of  WordPress installation, doesn’t work anymore on WP 2.6, so I have written an alternative version to finish the site I’m working on.

It’s a very small thing, not as complete as The excerpt reloaded, but, at least, it works, and it manages better than its inspirator the allowed tags, adding auto close to avoid pagination and validation errors.

It is based on the plain content of the post (like the content_rss in Kaf’s version) and like its predecessor, allowed tags cannot include <p> paragraphs, simply because I don’t need it on the site I’m currently developing, nor usually on any other. BTW, if somebody is interested, it can be easily fixed (or so I hope).

Parameters

Examples

<?php the_excerpt_rereloaded(); ?>
//display the excerpt with default settings.

<?php the_excerpt_rereloaded('80','More','<strong><em>','div','yes'); ?>
//display an excerpt of 80 words
//the link to full post is simply "more"
//allowed tags are strong and em
//the link path is <div class="more"><p><a href="#etc">More</a></p></div>
//text smileys are converted to graphic images

<?php the_excerpt_rereloaded('80','More','all','plain','no'); ?>
//display an excerpt of 80 words
//the link to full post is simply "more"
//all tags are accepted
//the link path is included in the excerpt paragraph with no additional container
//text smileys are NOT converted to graphic images

Download

Click here to download it, then upload it as usual in wp-content/plugins folder. Suggestions are welcome.

82 Responses to “WordPress plugin: the excerpt re-reloaded”

  1. 1 Jaypee said at 9:49 pm on December 4th, 2008

    the excerpt reloaded by Kaf Oseo works fine on my blog running WordPress 2.6.5.

  2. 2 Luca said at 9:57 pm on December 4th, 2008

    Hi Jaypee, thanks for letting me know. I’ve only tested with WP 2.6.2, and it doesn’t work. I’ve seen a couple of people with my same problem, so I decided to publish this small fix. It is simpler to edit and it fix also the problem with the open tags in the excerpt.

  3. 3 Jaypee said at 10:11 pm on December 4th, 2008

    No problem. I also used the excerpt reloaded plugin when I was using WordPress 2.6.2 and didn’t have any problems. Maybe your case and the ones who had problems with it was caused by a conflict with another plugin?

    But nevertheless, its good to see another alternative plugin for displaying excerpts. Keep up the good work! :)

  4. 4 Li-An said at 9:08 am on December 5th, 2008

    ‘Advanced Excerpt” plugin is interesting too :-)

  5. 5 DG said at 1:13 pm on December 5th, 2008

    First off, thanks for the update.

    I’m using Kaf ‘s excerpt_reloaded for past 2+ years, and have not faced problems so far.

  6. 6 WordPress Plugins 12/04/08 said at 1:19 pm on December 5th, 2008

    [...] you’re facing any problems with Kaf’s excerpt_reloaded plugin, Luca has updated the plugin to work with WordPress 2.6.x [...]

  7. 7 Luca said at 11:41 am on December 9th, 2008

    Thanks for your interest.

    No, I wasn’t running other plugins, a standard version of WP 2.6 BUT with italian localization. I suspect it could depend on this, I’ll try to test it asap.

  8. 8 Curb Duplicate content with customizable Excerpt plugin for Wordpress - Daily SEO blog said at 4:35 am on December 13th, 2008

    [...] That’s sweet ! Download the plugin here. [...]

  9. 9 WordPress Plugin Releases for 12/04 | HLBV said at 9:19 pm on December 13th, 2008

    [...] The excerpt re-reloaded [...]

  10. 10 Skuzzed.com » WordPress Plugin Releases for 12/04 said at 10:14 pm on December 13th, 2008

    [...] The excerpt re-reloaded [...]

  11. 11 Refresh your dead posts optimizing them for Search Engines with Wordpress 2.7 · SEO Marketing Tips - Tricks, Techniques & Secrets said at 11:46 am on December 15th, 2008

    [...] That’s course ! Download the plugin here. [...]

  12. 12 WordPress Plugin Releases for 12/04 | BlogBroker24-7 said at 1:46 pm on December 16th, 2008

    [...] The excerpt re-reloaded [...]

  13. 13 Monitor Your Website In SERPs | Free SEO Tool · SEO Guide - Tips, Tricks and Secrets said at 5:16 am on December 17th, 2008

    [...] That’s sweet ! Download the plugin here. [...]

  14. 14 SocialMedian is bought by XING · SEO Marketing Tips - Tricks, Techniques & Secrets said at 12:04 pm on December 19th, 2008

    [...] That’s course ! Download the plugin here. [...]

  15. 15 WordPress Plugin Releases for 12/21 | Weblog Tools Collection said at 2:23 pm on December 21st, 2008

    [...] Excerpt Re-reloaded [...]

  16. 16 WordPress Plugin Releases for 12/21 | Wordpress Blog NL said at 10:59 pm on December 21st, 2008

    [...] Excerpt Re-reloaded [...]

  17. 17 WeblogToolsCollection Español » Archivo del Blog » Novedades Plugins de WordPress 21/12 said at 2:55 pm on December 23rd, 2008

    [...] Excerpt Re-reloaded [...]

  18. 18 WordPress Plugin Releases for 12/21 | New Port Me said at 10:02 am on December 26th, 2008

    [...] Excerpt Re-reloaded [...]

  19. 19 paul said at 4:28 pm on January 19th, 2009

    this plugin rocks, its actually one of the most usful i have found. there is just one feature i wish it had. the ability to remove strings or something similar. im using next-gen to place an image within a post (i would rather do it another way but this is the easiest for the noobies who want people to make them a website.

    the except includes the call to the gallery

    “[singlepic=14,320,240,,left]Sales are key to all businesses and how you gain sales will vary depending on your business and the market you work in. Many business do not have a structured sales …”

    is there any way to remove that first call? without placing the image within the custom fields?

  20. 20 Karsten said at 3:02 pm on March 13th, 2009

    I double paul’s request.

    It would be great to have the ability to filter elements in brackets like [galery=x], [audio:filename.mp3] [singlepic=...] etc.

    Even without this, it’s really cool plugin. But with it, it would rock :)

  21. 21 Karsten said at 3:47 pm on March 13th, 2009

    Refering to my previous comment, maybe the could be done by replacing line 52

    $text = strip_tags($post->post_content, $allowed_tags);

    with

    $text = preg_replace(‘/\[.*\]/’, ”, strip_tags($post->post_content, $allowed_tags));

    (based on version 0.3 of your plugin)

  22. 22 Luca said at 5:39 pm on March 13th, 2009

    Hi Karsten, thank you for your replies. I’ve been very busy and I’ve forgotten Paul’s request. I try to add this feature, starting from your tip. Stay in tune!

    Ciao
    Luca

  23. 23 Luca said at 9:34 am on March 15th, 2009

    Karsten, I’ve tested your fix and it works fine. I’ve included it in the new version (0.3.1) of the plugin, giving you the credits for it.

  24. 24 baron said at 5:24 pm on March 19th, 2009

    Works great, thank you

  25. 25 Jim seo said at 6:57 am on March 28th, 2009

    works like a charm

  26. 26 WPWeekly Episode 49 - Were You Fooled? said at 4:37 am on April 4th, 2009

    [...] – The Excerpt re-reloaded – This plugin is based off of the Excerpt Reloaded plugin by Kaf Oseo. The highlight of this plugin [...]

  27. 27 lephio said at 7:11 pm on May 1st, 2009

    gran lavoro! proprio quello che cercavo!

    complimenti!

  28. 28 Ronnie said at 11:04 pm on May 11th, 2009

    i’ve uploaded the plugin and activated it but how do i use it? i don’t see it anywhere

    thank you

  29. 29 Luca said at 8:07 am on May 12th, 2009

    Hi Ronnie, just call the_excerpt_rereloaded() within the loop.

    See above for the examples.

  30. 30 Ronnie said at 10:14 am on May 12th, 2009

    i’m not sure what you mean Luca, could you please explain?… i’m very much a noob

    do is work along withthe ‘more’ command when writting posts?

    thanks for your help

  31. 31 Luca said at 10:21 am on May 12th, 2009

    No, you have to edit your theme pages (the ones where you want to show only the abstract), i.e. index.php. Where you find the_content(), replace it with the_excerpt_reloaded() and instead of the whole post content you will show the excerpt.

    Check here for more information about the loop.

  32. 32 Henk said at 7:36 am on May 19th, 2009

    Aah, that should be of course. re_reloaded !! With the extra ‘re’.
    Works great. Thanks Luca (using 2.7.1).
    If you use ‘plain’ in the statement, the “Read more..” statement shows up nicely on the same text line. Good. Offcourse because it then is included in the section of the shorted message.
    Nb. my site is still in test-fase. I am converting to WordPress. Learning every day.

  33. 33 Ella said at 6:36 am on June 4th, 2009

    Hi…! This rocks. You rock. Thank you for sharing and helping people out. I send you a virtual beer :)

  34. 34 WPTavern Celebrates Thank A Plugin Author Day! said at 11:33 am on June 4th, 2009

    [...] The Excerpt re-reloaded » Luca Biagini (url) This plugin does something more than the built-in excerpt function. It lets choose exceprt length, allowed html tags, the link text to full post and the html container of the excerpt (,, or plain text). [...]

  35. 35 henk said at 7:27 am on June 17th, 2009

    Hi Luca,

    I noticed that for the excerpt length, the words in an image title, under the images “Advanced links”, are included in the count; that is when the image is the first item in the post and I have “a” as allowed tag. The excerpt itself does not show the image, but still it is that number of words shorter than the other excerpts.
    So, now I leave that “Advanced title” empty.
    Still happy with it.

  36. 36 Luca said at 8:49 am on June 17th, 2009

    Hi Henk!

    Thank you for letting me know, I havent noticed yet. I’ll take a look and try to fix it in the next version of my plugin.

    Ciao
    Luca

  37. 37 Francesco Laruina said at 8:32 am on June 25th, 2009

    It works fine on WP 2.8.
    Very good Plugin!
    Thank you!

  38. 38 Wordpress e re-reloaded excerpt | francescolaruina.netsons.org said at 9:00 am on June 25th, 2009

    [...] porre rimedio a questo “problema” ho installato il plugin re-reloaded excerpt con la solita [...]

  39. 39 Kersheys said at 2:59 pm on September 24th, 2009

    Hey there. This plugin is working fine on 2.8.4 and I have to say it’s absolutely great. I’d been looking for a proper one to replace a previous plugin because it didn’t list the “read more” link after a few updates. Thanks a lot for it!

    I’d just like to say that the codes for emoticons don’t display properly even if the parameters are set to display all tags. Not really crucial, but it would be awesome if you could do a small fix? Only if you have the time, of course :)

    Thanks again!

  40. 40 Luca said at 3:05 pm on September 25th, 2009

    Hi Kersheys, I’don’t use emoticons and I haven’t noticed the problem. I’ve fixed it, check back soon for the new version. Thank you for posting. Ciao!
    Luca

  41. 41 Kersheys said at 5:03 am on September 29th, 2009

    Awesome. Thank you! Updated and done~ :D

  42. 42 Stuart said at 3:48 pm on September 29th, 2009

    I would indeed love to have paragraph breaks preserved as I desperately need it for my site! If it’s an easy fix certainly consider including it. Thanks!

  43. 43 adrian boioglu said at 4:38 am on October 1st, 2009

    Hello Luca,

    Please make this plugin preserve the paragraph breaks. i really need it on my blog.

    keep up the good work!

    Thank you

  44. 44 Stanmc said at 9:46 pm on October 1st, 2009

    WordPress newbie, using the Excerpt Rereloaded plugin (thank you) but my images are not showing up in home page summary. They are a single image placed first, ahead of the copy, if it matters. I have indicated “all” in the allowed tags code. If I change index.php code from “the_excerpt_rereloaded()” to “the_content()” they show up. Any thoughts?
    TIA

  45. 45 Luca said at 9:50 pm on October 1st, 2009

    @stanmc

    By default images are not shown, you should specify it. See examples above.
    That should work for you. Let me know otherwise.

    @adrian & stuart

    Unfortunately my plugin is based on excerpt_rss, so there’s no way to handle the “p” tag. I could try to manage it in the future, but that’s a pretty heavy modification I guess. Stay tuned!

    Ciao
    Luca

  46. 46 Patrick Luk said at 9:38 am on November 5th, 2009

    Hi Luca,

    Thanks for the wonderful plugin. Just wonder if there is an luck for using it with double-byte language like Chinese.

    In the meantime, I am falling back to the tag with my site.

    Thanks in advance.

  47. 47 zamaan said at 8:02 pm on November 10th, 2009

    Hai folks,
    i am a newbi to wp. still setting up the stuff. i already spend number of days fixing this excerpt thing by trying various excerpt plugins. non of them worked or had all the customizations i needed. finally i found your one was promissing and it allow exacly waht i wanted.

    i just downloded the zip from wp plugin site. i open the the_excerpt_reloaded.php and put ‘all’ for $allowed_tags and included tag in the if section. [code] if ( $allowed_tags == 'all' ) $allowed_tags = ',,,,,,,,,

    ,,';[/code] . then uploaded and activaed the plugin. unfortunely, i dont see the plugin is working :(
    pls check my site. whats wrong?

  48. 48 zamaan said at 8:14 pm on November 10th, 2009

    i just followed stanmc’s suggession.
    that is replacing the “the_excerpt_rereloaded()” to “the_content()”. now its working. but still there are issues.
    1. object tag not working even though i included in the if condition.
    2. hanged image fit plugin also seems not working.

    :(

  49. 49 zamaan said at 8:41 pm on November 10th, 2009

    really really sorry to bump. the plugin now works really well on my wp 8.5. i only have one issue now. the image fit plugin does not work. coz it raps the resized image in ‘p’ tag. so until i find a fix for that, i just sticked to my old excerpt plugin (which does not have a facility to customized allowed tags).

    pls try to fix this p tag issue.

  50. 50 Luca said at 8:44 pm on November 10th, 2009

    @Patrick
    I’m sorry, I’ve got really no experience with chinese, I don’t absolutely know how to help :(

    @zamaan
    Glad my plugin may help you, but unfortunately the object tag is not supported, and I don’t know the plugin you mentioned.

  51. 51 The Excerpt re-Reloaded | Developing Argyll Communities said at 7:29 pm on November 28th, 2009

    [...] of the default Argyll Communities theme by replacing the normal ‘the_excerpt’ tag by Luca Biagini’s ‘the_excerpt_rereloaded’. This allows us to control the appearance of the excerpted [...]

  52. 52 Henk said at 11:56 am on December 6th, 2009

    I upgraded my testsite to WP2.8.6 and using Advanced Title for images killed my read more link (it was visible but not linked). I solved that by letting out the “a” tag because the Advanced Title apparently created a starting “a” without closing it. So now I use

    and that works good on WP 2.8.6

    NB that is the first ‘no’ behind the raquo statement.
    Nb2 the ‘plain’ still succeeds in having the –>> on the same line instead of a new line, good.

  53. 53 Henk said at 11:57 am on December 6th, 2009

    Sorry, can’t edit, so here goes again:
    I upgraded my testsite to WP2.8.6 and using Advanced Title for images killed my read more link (it was visible but not linked). I solved that by letting out the because the Advanced Title apparently created a starting without closing it. So now I use:

    (try to use backticks now fo showing code)
    and that works good on WP 2.8.6
    NB that is the first ‘no’ behind the raquo statement.
    Nb2 the ‘plain’ still succeeds in having the –>> on the same line instead of a new line, good.

  54. 54 Henk said at 11:58 am on December 6th, 2009

    No luck:
    php the_excerpt_rereloaded(’11′,’—»»’,'no’,'plain’,'no’);

  55. 55 MD said at 8:12 am on December 9th, 2009

    Hi!

    I’ve changed this line of the plugin:

    $text = preg_replace(‘/\[.*\]/’, ”, strip_tags($post->post_excerpt, $allowed_tags));

    Now instead of showing the content of the post, the plugin is showing the excerpt. The only problem is that when a post does not have an excerpt added manually, the plugin does not try to get the content.

    I think that the perfect behaviour would be:
    - check if there is excerpt, and if it is not blank, show the excerpt.
    - if there is no excerpt, show the_content.

    What do you think?

  56. 56 Pierre said at 10:12 am on December 10th, 2009

    When I use [caption] in the beginning of a post (my post start with an image to the left of the text), the plugin won’t filter that tag away:
    This is visible in the excerpt on my page, before the rest of the text:
    [caption id="attachment_279" align="alignleft" width="139" caption="Glenn Svarts"][/caption]

    I’m guessing that something is missing in this line to be able to hide the [caption]-tag/content?

    $text = preg_replace(‘/\[.*\]/’, ”, strip_tags($post->post_content, $allowed_tags));

  57. 57 Marty Thornley said at 12:44 am on December 29th, 2009

    Hey Luca,

    I have used this plugin on several sites but have occasionally been frustrated by what happens when only an image or only a video appears, returning an essentially empty excerpt.

    So I wrote a companion function to get the output rather than automatically echo it. I called it get_the_excerpt_rereloaded() – it uses all of your same ideas but returns the output so I can test it and not display anything if it is empty.

    I also noticed that essentially empty $output variables were actually a long string of spaces, so adding a trim statement emptied out any empty excerpts allowing me to test for whether it was empty.

    I am just using it as a standalone plugin right now, but would love to send you the code if you want to check it out and maybe incorporate into the next version.

    Thanks for the great plugin!

    Marty

  58. 58 Fábio ZC said at 10:38 pm on February 12th, 2010

    Hey! First of all.. thanks for this plugin!

    So.. i need to make a Page excerpts (I do with “Page Excerpt” plugin) with the excerpt re-reloaded plugin..

    somebody can help me?

    Thanks a lot

  59. 59 Vernal said at 7:16 pm on February 24th, 2010

    Hey Thanks for this nice plugin. I have ‘all’ set for allowed tags, yet the plugin does not allow any images that happen to have a caption associated. Images without captions spit out just fine… but images with do not. Is it a problem with the plugin stripping out shortcodes? Can you change it?

  60. 60 Benjibuls said at 7:37 am on March 4th, 2010

    Great plugin, saved my bacon. Only request for a feature would be to be able to change the words value to ‘more’ if necessary so that it could rely on the tag instead of just numeric values.

  61. 61 Better Post Excerpt « Pippin's Pages said at 4:58 am on March 21st, 2010

    [...] Aside from writing multiple custom excerpt functions in functions.php, I found this plugin: The Excerpt Re-reloaded [...]

  62. 62 Automatiskt utdrag/excerpt ! « Samlade sakur said at 11:04 pm on March 27th, 2010

    [...] fungerar upp till WordPress 2.9.2 och är väldigt smidig. Länk till författaren utav pluginet Lucabiagini.com Tags: custom, excerpt, [...]

  63. 63 Automatic WP Thumbnails & Proportional Excerpts | Pro Blog Design said at 5:01 pm on April 22nd, 2010

    [...] function to give the variable $t3 a value for the the_excerpt_rereloaded function. I use this plugin to display a custom ‘Read more’ text: [»] (You’ll need to install the plugin to [...]

  64. 64 Better Wordpress Post Excerpt – Revamped « Pippin's Pages said at 8:37 pm on April 22nd, 2010

    [...] about a way to improve upon the default wordpress post excerpt by utilizing a plugin called the Excerpt Rereloaded. Luca Biagini wrote a great plugin that is all well and good for most people, but what about theme [...]

  65. 65 Bullman Design : Handy Wordpress Plugins said at 10:02 pm on May 31st, 2010

    [...] The Excerpt re-reloaded [...]

  66. 66 Angus said at 2:13 pm on July 3rd, 2010

    Great plugin!

    @MD (and anyone else interested) – in order to get this plugin to generate from a manual excerpt if provided, and the post body otherwise, replace this line:

    $text = preg_replace(‘/\[.*\]/’, ”, strip_tags($post->post_content, $allowed_tags));

    with this:

    $orig = $post->post_excerpt;
    if (empty($orig)) {
    $orig = $post->post_content;
    }
    $text = preg_replace(‘/\[.*\]/’, ”, strip_tags($orig, $allowed_tags));

    Hth. – Gus

  67. 67 Henkie’s Recepten | Ultranex said at 1:13 pm on July 19th, 2010

    [...] The Excerpt re-reloaded – http://www.lucabiagini.com/2008/11/wordpress-plugin-the-excerpt-re-reloaded/ [...]

  68. 68 Martin said at 9:48 pm on August 6th, 2010

    Hi!
    How to I prevent from specific code to appear in the excerpt? For instance, I use a Youtube Plugin that requires the following code to be added in my posts for the video to appear:
    httpvh://www.youtube.com/watch?v=CODE

    I would like this line to NOT appear in the excerpts. How?

    See this screenshot from visual reference:
    http://img238.imagevenue.com/img.php?image=27186_capture_123_179lo.jpg

    Thanks for your help!

  69. 69 Plugins essenciais para seu blog Wordpress | RBTech.info said at 12:12 pm on November 8th, 2010

    [...] The Excerpt re-reloaded: permite exibir um resumo de cada post e não seu texto completo; [...]

  70. 70 Dexter said at 6:15 am on December 30th, 2010

    first of all, thanks for this great plugin.

    I used the default settings of the plugin, but why it doesn’t diplay the image of my post?

    Please help. Thanks :D Great plugin.

  71. 71 sam said at 8:36 pm on March 31st, 2011

    I have the plugin installed but I don’t see where I go to customize it?

  72. 72 Elle said at 10:48 am on April 19th, 2011

    I have made some adjustments to the code to allow for breaks ( / ) to be allowed. I will try & post the code here:


    function the_excerpt_rereloaded($words = 40, $link_text = 'Continue reading this entry »', $allowed_tags = '', $container = 'p', $smileys = 'no' )
    {
    global $post;

    if ( $allowed_tags == 'all' ) $allowed_tags = ',,,,,,,,,,

    ,';

    //preserving tags in excerpt
    $text = preg_replace('/\[.*\]/', '', strip_tags(apply_filters('the_content', $post->post_content), $allowed_tags));

    //replacing p tags with br to allow read more link to be flush with text (optional)
    $text = preg_replace("/]*>/", "", $text);
    $text = str_replace("", "", $text);

    $text = explode(' ', $text);
    $tot = count($text);

    for ( $i=0; $i

    <?php if ( $i ...
    <?php if ( $i < class="more">

    <a href="" title="">

    </>

  73. 73 Elle said at 10:49 am on April 19th, 2011

    Sorry – it stripped out quite a lot there… thought it might. I can send my adjusted file to anyone who wants it.

  74. 74 Plugins essenciais para seu blog WordPress | said at 10:16 pm on April 21st, 2011

    [...] The Excerpt re-reloaded: permite exibir um resumo de cada post e não seu texto completo; [...]

  75. 75 AJ said at 11:49 pm on June 17th, 2011

    This is a great plugin. Everything is working perfectly and I’ve even built it into a few themes. Thanks for the code!

  76. 76 Matt said at 12:50 pm on June 22nd, 2011

    Does not work.

  77. 77 Matt said at 12:53 pm on June 22nd, 2011

    Sorry. My Mistake..

    It does work just jump into your loop.php and add “_rereloaded” to the end of “the_excerpt”

    I will test and report back.

  78. 78 JD said at 2:28 pm on August 23rd, 2011

    Doesnt work. I cant see the widget in the widgets page. Im running wp 3.2.1

  79. 79 Luca said at 11:13 am on August 24th, 2011

    It does work indeed. No widget. Read the instructions.

  80. 80 Handy Wordpress Plugins | Bullman Design said at 11:43 pm on November 29th, 2011

    [...] The Excerpt re-reloaded [...]

  81. 81 Casey said at 6:44 pm on March 12th, 2012

    Plugin download link appears to be broken :(

  82. 82 Luca said at 8:00 am on March 13th, 2012

    @Casey Fixed!

Leave a Reply