continue reading link on custom excerpt in TwentyTen, props iandstewart, fixes #13361

git-svn-id: http://svn.automattic.com/wordpress/trunk@15040 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
wpmuguru 2010-05-28 17:01:27 +00:00
parent 70b6f9c478
commit 84739b1583
1 changed files with 17 additions and 4 deletions

View File

@ -249,7 +249,17 @@ function twentyten_excerpt_length( $length ) {
add_filter( 'excerpt_length', 'twentyten_excerpt_length' );
/**
* Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis.
* Returns a "Continue Reading" link for excerpts
*
* @since Twenty Ten 1.0
* @return string "Continue Reading" link
*/
function twentyten_continue_reading_link() {
return ' <a href="'. get_permalink() . '">' . __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) . '</a>';
}
/**
* Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and twentyten_continue_reading_link().
*
* To override this in a child theme, remove the filter and add your own
* function tied to the excerpt_more filter hook.
@ -258,12 +268,12 @@ add_filter( 'excerpt_length', 'twentyten_excerpt_length' );
* @return string An ellipsis
*/
function twentyten_auto_excerpt_more( $more ) {
return ' &hellip;';
return ' &hellip;' . twentyten_continue_reading_link();
}
add_filter( 'excerpt_more', 'twentyten_auto_excerpt_more' );
/**
* Adds a pretty "Continue Reading" link to post excerpts.
* Adds a pretty "Continue Reading" link to custom 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.
@ -272,7 +282,10 @@ add_filter( 'excerpt_more', 'twentyten_auto_excerpt_more' );
* @return string Excerpt with a pretty "Continue Reading" link
*/
function twentyten_custom_excerpt_more( $output ) {
return $output . ' <a href="'. get_permalink() . '">' . __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) . '</a>';
if ( has_excerpt() ) {
$output .= twentyten_continue_reading_link();
}
return $output;
}
add_filter( 'get_the_excerpt', 'twentyten_custom_excerpt_more' );