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:
parent
70b6f9c478
commit
84739b1583
|
@ -249,7 +249,17 @@ function twentyten_excerpt_length( $length ) {
|
||||||
add_filter( 'excerpt_length', 'twentyten_excerpt_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">→</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
|
* To override this in a child theme, remove the filter and add your own
|
||||||
* function tied to the excerpt_more filter hook.
|
* function tied to the excerpt_more filter hook.
|
||||||
|
@ -258,12 +268,12 @@ add_filter( 'excerpt_length', 'twentyten_excerpt_length' );
|
||||||
* @return string An ellipsis
|
* @return string An ellipsis
|
||||||
*/
|
*/
|
||||||
function twentyten_auto_excerpt_more( $more ) {
|
function twentyten_auto_excerpt_more( $more ) {
|
||||||
return ' …';
|
return ' …' . twentyten_continue_reading_link();
|
||||||
}
|
}
|
||||||
add_filter( 'excerpt_more', 'twentyten_auto_excerpt_more' );
|
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
|
* To override this link in a child theme, remove the filter and add your own
|
||||||
* function tied to the get_the_excerpt filter hook.
|
* 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
|
* @return string Excerpt with a pretty "Continue Reading" link
|
||||||
*/
|
*/
|
||||||
function twentyten_custom_excerpt_more( $output ) {
|
function twentyten_custom_excerpt_more( $output ) {
|
||||||
return $output . ' <a href="'. get_permalink() . '">' . __( 'Continue reading <span class="meta-nav">→</span>', 'twentyten' ) . '</a>';
|
if ( has_excerpt() ) {
|
||||||
|
$output .= twentyten_continue_reading_link();
|
||||||
|
}
|
||||||
|
return $output;
|
||||||
}
|
}
|
||||||
add_filter( 'get_the_excerpt', 'twentyten_custom_excerpt_more' );
|
add_filter( 'get_the_excerpt', 'twentyten_custom_excerpt_more' );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue