Spare Pencil

August 21 130 comments
Watch the replies

Advanced Excerpt plugin for WordPress

I promised to release some WordPress plugins I’ve been working on. Well, here is the first one! :)

It’s called “Advanced Excerpt” and basically it just improves the way excerpts are created. By default, if a post has no explicit excerpt, WordPress creates one by grabbing the post content, stripping all the tags, shortening it to a (hard-coded) length and adding an ellipsis (which is, by the way, also hard-coded). The result: a dull excerpt.

This plugin changes that. The most notable feature is that it keeps your HTML. Furthermore, it allows you to choose the length of the excerpt (using either words or characters) and which character(s) is/are used as an ellipsis. You can even choose which HTML tags are stripped and which are not! It is very useful if your WordPress theme uses excerpts at prominent places (like mine).

There is another plugin that attempts to improve excerpt creation, but I tried it and it just doesn’t work properly (in fact, it inspired me to write a better one). One major problem is that it breaks your HTML. My plugin solves this by counting only the words or characters that are not part of an HTML tag and by properly closing tags that are left open.

If you want to see it in action, just look at my front page, a category or try a search. Of course, you can also download it yourself. ;)


130 Comments

Write one, too!

Reply Here




You may use some markup in your comment, unless you're drunk.
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>