From fc470dfaebfc7d453dfedd09262cc25b79c03120 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Tue, 25 May 2010 16:08:44 +0000 Subject: [PATCH] Always show 'Continue reading' link when dealing with excerpts in Twenty Ten. props iandstewart, fixes #13361. git-svn-id: https://develop.svn.wordpress.org/trunk@14889 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-content/themes/twentyten/functions.php | 26 +++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/wp-content/themes/twentyten/functions.php b/wp-content/themes/twentyten/functions.php index 0be6759d3c..46c86461b3 100644 --- a/wp-content/themes/twentyten/functions.php +++ b/wp-content/themes/twentyten/functions.php @@ -244,18 +244,32 @@ function twentyten_excerpt_length( $length ) { add_filter( 'excerpt_length', 'twentyten_excerpt_length' ); /** - * Sets the "read more" link to something pretty. + * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis. * - * To override this link in a child theme, remove the filter and add your own + * To override this in a child theme, remove the filter and add your own * function tied to the excerpt_more filter hook. * * @since Twenty Ten 1.0 - * @return string A pretty 'Continue reading' link. + * @return string An ellipsis */ -function twentyten_excerpt_more( $more ) { - return ' … ' . __('Continue reading ', 'twentyten') . ''; +function twentyten_auto_excerpt_more( $more ) { + return ' …'; } -add_filter( 'excerpt_more', 'twentyten_excerpt_more' ); +add_filter( 'excerpt_more', 'twentyten_auto_excerpt_more' ); + +/** + * Adds a pretty "Continue Reading" link to post excerpts. + * + * To override this link in a child theme, remove the filter and add your own + * function tied to the get_the_excerpt filter hook. + * + * @since Twenty Ten 1.0 + * @return string Excerpt with a pretty "Continue Reading" link + */ +function twentyten_custom_excerpt_more( $output ) { + return $output . ' ' . __( 'Continue reading ', 'twentyten' ) . ''; +} +add_filter( 'get_the_excerpt', 'twentyten_custom_excerpt_more' ); /** * Remove inline styles printed when the gallery shortcode is used.