From 925df4bd49168ebf44ba27eef34db0242cd809fe Mon Sep 17 00:00:00 2001 From: Peter Westwood Date: Wed, 9 Sep 2009 16:34:44 +0000 Subject: [PATCH] Give plugins and themes simple control over the text displayed at the end of an autogenerated excerpt. Fixes #10395 props ramiy. git-svn-id: https://develop.svn.wordpress.org/trunk@11907 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/formatting.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index bed4f50616..40b41ec5dc 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -1696,9 +1696,12 @@ function human_time_diff( $from, $to = '' ) { * 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. * + * 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 + * * @since 1.5.0 * - * @param string $text The exerpt. If set to empty an excerpt is generated. + * @param string $text The excerpt. If set to empty an excerpt is generated. * @return string The excerpt. */ function wp_trim_excerpt($text) { @@ -1712,10 +1715,11 @@ function wp_trim_excerpt($text) { $text = str_replace(']]>', ']]>', $text); $text = strip_tags($text); $excerpt_length = apply_filters('excerpt_length', 55); + $excerpt_more = apply_filters('excerpt_more', '[...]'); $words = explode(' ', $text, $excerpt_length + 1); if (count($words) > $excerpt_length) { array_pop($words); - array_push($words, '[...]'); + array_push($words, $excerpt_more); $text = implode(' ', $words); } }