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
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">→</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 ' …' . twentyten_continue_reading_link();
}
add_filter( 'excerpt_more', 'twentyten_auto_excerpt_more' );
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>';