[wp-hackers] improving the_excerpt()
"Choan C. Gálvez"
choan.galvez at gmail.com
Thu Oct 27 15:47:21 GMT 2005
Amit Gupta escribió:
> another thing that I just remembered. the current the_excerpt() strips
> out HTML tags & then creates a summary of the post to be displayed if
> none is specified. Now that creates quite a bit of problem for some
> people(including myself) who use any of the code hiliting plugins etc.
> since then the code looks like plain text & a bit ugly. Now, what I was
> asking is, has it been taken care of? I mean an excerpt created without
> ripping out the HTML tags? I know this will be a bit difficult & tricky,
> but then, thats what our job is, some RegEx checks would have to be made
> to be sure of cutting the text on the point where the the last opened
> tag is closed.
> any suggestions?
Yep. I've developed a function, called XHTMLexcerpt that trims any HTML
string to X words, closing any open tags after that, appending "..." or
any string you want if content is longer, and blah blah.
Based on that function I did a plugin, which I cannot send to you
because it's sleeping at home (and currently I'm at the office).
Please send me a private email to choan.galvez at gmail.com if you are
interested in receiving the code.
More information about the wp-hackers