0

My today's question is... is there any way to auto add an custom (whatever I want) Read more... each time I use the_excerpt or get_the_excerpt function???

Thanks in advance

2 Answers 2

1

From Twenty Ten's functions.php:

 /**
 * 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.
 *
 * @since Twenty Ten 1.0
 * @return string An ellipsis
 */
function twentyten_auto_excerpt_more( $more ) {
    return ' &hellip;' . twentyten_continue_reading_link();
}
add_filter( 'excerpt_more', 'twentyten_auto_excerpt_more' );
1

I can't remember if I've modified the_excerpt() in my code somehow but I've just been using this in my loop

global $post;

the_excerpt();
echo '<a href="' . get_permalink($post->ID) . '" class="profile_postlink">Read more...</a>';
2
  • that is exactly what I'm using now, w/o results I want =( Commented Nov 23, 2011 at 19:03
  • Can you post your code please?
    – EddyR
    Commented Nov 24, 2011 at 6:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.