From b4e7804bf0eb78457d0a3e965679a5fe7df4931e Mon Sep 17 00:00:00 2001 From: westi 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: http://svn.automattic.com/wordpress/trunk@11907 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- 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); } }