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

git-svn-id: https://develop.svn.wordpress.org/trunk@15040 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ron Rennick 2010-05-28 17:01:27 +00:00
parent 44621fee7d
commit 88e05ab89f

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' );