Make the excerpt_more filter include the space. Props demetris. fixes #11456

git-svn-id: http://svn.automattic.com/wordpress/trunk@12414 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2009-12-16 16:38:58 +00:00
parent 776b710525
commit b82594d1cd

View File

@ -1788,11 +1788,11 @@ function human_time_diff( $from, $to = '' ) {
* Generates an excerpt from the content, if needed. * Generates an excerpt from the content, if needed.
* *
* The excerpt word amount will be 55 words and if the amount is greater than * The excerpt word amount will be 55 words and if the amount is greater than
* that, then the string '[...]' will be appended to the excerpt. If the string * that, then the string ' [...]' will be appended to the excerpt. If the string
* is less than 55 words, then the content will be returned as is. * is less than 55 words, then the content will be returned as is.
* *
* The 55 word limit can be modified by plugins/themes using the excerpt_length filter * The 55 word limit can be modified by plugins/themes using the excerpt_length filter
* The '[..]' string can be modified by plugins/themes using the excerpt_more filter * The ' [...]' string can be modified by plugins/themes using the excerpt_more filter
* *
* @since 1.5.0 * @since 1.5.0
* *
@ -1810,12 +1810,12 @@ function wp_trim_excerpt($text) {
$text = str_replace(']]>', ']]>', $text); $text = str_replace(']]>', ']]>', $text);
$text = strip_tags($text); $text = strip_tags($text);
$excerpt_length = apply_filters('excerpt_length', 55); $excerpt_length = apply_filters('excerpt_length', 55);
$excerpt_more = apply_filters('excerpt_more', '[...]'); $excerpt_more = apply_filters('excerpt_more', ' ' . '[...]');
$words = explode(' ', $text, $excerpt_length + 1); $words = explode(' ', $text, $excerpt_length + 1);
if (count($words) > $excerpt_length) { if (count($words) > $excerpt_length) {
array_pop($words); array_pop($words);
array_push($words, $excerpt_more);
$text = implode(' ', $words); $text = implode(' ', $words);
$text = $text . $excerpt_more;
} }
} }
return apply_filters('wp_trim_excerpt', $text, $raw_excerpt); return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);