WordPress’ the_excerpt() template tag is used in most
themes for browsing the archives and categories of a blog. Rather than
displaying the full content of the post, the excerpt displays a short snippet of
the content. Unless you manually enter in an excerpt when writing each post,
WordPress grabs the first 55 words of the post and uses that as the excerpt.
So far so good, but there are problems with the way WordPress does this.
Word count – 55 words is a good number, but what if you want more or
Formatting – WordPress strips out all HTML tags. This gets rid of images
and links, but can also get rid of paragraph formatting, making the entire
excerpt one long paragraph without any line breaks.
result in some plugins’ messy script appearing in your excepts. Not only does
this look rubbish, it can be a vulnerability too.
Stačí z wp-includes/formatting.php zkopírovat funkci
wp_trim_excerpt, přejmenovat ji třeba na
better_excerpt a vložit ji do functions.php
(Vzhled > Upravit soubory)