Make WordPress Core


Ignore:
Timestamp:
05/28/2010 05:01:27 PM (15 years ago)
Author:
wpmuguru
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/themes/twentyten/functions.php

    r14955 r15040  
    250250
    251251/**
    252  * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis.
     252 * Returns a "Continue Reading" link for excerpts
     253 *
     254 * @since Twenty Ten 1.0
     255 * @return string "Continue Reading" link
     256 */
     257function twentyten_continue_reading_link() {
     258    return ' <a href="'. get_permalink() . '">' . __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) . '</a>';
     259}
     260
     261/**
     262 * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and twentyten_continue_reading_link().
    253263 *
    254264 * To override this in a child theme, remove the filter and add your own
     
    259269 */
    260270function twentyten_auto_excerpt_more( $more ) {
    261     return ' &hellip;';
     271    return ' &hellip;' . twentyten_continue_reading_link();
    262272}
    263273add_filter( 'excerpt_more', 'twentyten_auto_excerpt_more' );
    264274
    265275/**
    266  * Adds a pretty "Continue Reading" link to post excerpts.
     276 * Adds a pretty "Continue Reading" link to custom post excerpts.
    267277 *
    268278 * To override this link in a child theme, remove the filter and add your own
     
    273283 */
    274284function twentyten_custom_excerpt_more( $output ) {
    275     return $output . ' <a href="'. get_permalink() . '">' . __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) . '</a>';
     285    if ( has_excerpt() ) {
     286        $output .= twentyten_continue_reading_link();
     287    }
     288    return $output;
    276289}
    277290add_filter( 'get_the_excerpt', 'twentyten_custom_excerpt_more' );
Note: See TracChangeset for help on using the changeset viewer.