Wordpress plugin: the excerpt re-reloaded
UPDATED!
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
- words (integer): number of words to display before ending the excerpt. Default is 40.
- link_text (string): defines the text for the link to the full post. Default is “Keep reading this entry »”. Of course it is displayed only if the selected length is less than the full content. It is displayed in a <p> pararaph with its specific class (more), so it can be easily stylized.
- allowed_tags (string): defines which HTML tags to accept. Use the format ‘<img>’. For multiple tags, enter as single string: ‘<a><img>’. No tag allowed by default. NEW! Set to ‘all’ to accept all tags.
- NEW! container (string): defines the container of the excerpt: paragraph, span, div, or none. The container has a specific class=”more” to easily customize its layout through css. If you choose a “div” container, an additional “p” tag inside the div is automatically included. Default is “p”, for no container use “plain”.
Examples
<?php the_excerpt_rereloaded(); ?>
//display the excerpt with default settings.
<?php the_excerpt_rereloaded('80','More','<strong><em>','div'); ?>
//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>
<?php the_excerpt_rereloaded('80','More','all','plain'); ?>
//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
Download
Click here to view, copy, paste und upload as usual in wp-content/plugins folder. Suggestions are welcome.
Older versions
the excerpt reloaded by Kaf Oseo works fine on my blog running WordPress 2.6.5.
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.
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!
‘Advanced Excerpt” plugin is interesting too
First off, thanks for the update.
I’m using Kaf ’s excerpt_reloaded for past 2+ years, and have not faced problems so far.
[...] you’re facing any problems with Kaf’s excerpt_reloaded plugin, Luca has updated the plugin to work with WordPress 2.6.x [...]
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.
[...] That’s sweet ! Download the plugin here. [...]
[...] The excerpt re-reloaded [...]
[...] The excerpt re-reloaded [...]
[...] That’s course ! Download the plugin here. [...]
[...] The excerpt re-reloaded [...]
[...] That’s sweet ! Download the plugin here. [...]
[...] That’s course ! Download the plugin here. [...]
[...] Excerpt Re-reloaded [...]
[...] Excerpt Re-reloaded [...]
[...] Excerpt Re-reloaded [...]
[...] Excerpt Re-reloaded [...]
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?
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
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)
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
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.
Works great, thank you
works like a charm
[...] – The Excerpt re-reloaded – This plugin is based off of the Excerpt Reloaded plugin by Kaf Oseo. The highlight of this plugin [...]
gran lavoro! proprio quello che cercavo!
complimenti!
i’ve uploaded the plugin and activated it but how do i use it? i don’t see it anywhere
thank you
Hi Ronnie, just call the_excerpt_rereloaded() within the loop.
See above for the examples.
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
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.
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.
Hi…! This rocks. You rock. Thank you for sharing and helping people out. I send you a virtual beer
[...] 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). [...]
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.
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
It works fine on WP 2.8.
Very good Plugin!
Thank you!
[...] porre rimedio a questo “problema” ho installato il plugin re-reloaded excerpt con la solita [...]