Is there an easy way to add another 'read more' link? I'm using the standard 'continue reading' link for some posts but I also want to use a different text like 'more info' for other posts. Can I do this using the_excerpt
?
Later update: This are the two standard twentyelven functions that are used for the 'read more' or 'continue reading' links.
function twentyeleven_continue_reading_link() {
return ' <a href="'. esc_url( get_permalink() ) . '">' . __( '<span class="more">more +</span>', 'twentyeleven' ) . '</a>';
}
function twentyeleven_auto_excerpt_more( $more ) {
return ' …' . twentyeleven_continue_reading_link();
}
add_filter( 'excerpt_more', 'twentyeleven_auto_excerpt_more' );
Based on amit code I though about including an if / else
statement in the twentyeleven_auto_excerpt_more
function, but I did something wrong because it doesn't work.
This is the code:
function twentyeleven_auto_excerpt_more( $more ) {
$read_more_link_2 = "View Image";
if ( in_category( 'events' )) {
return $read_more_link_2;
} else {
return ' …' . twentyeleven_continue_reading_link();
}
add_filter( 'excerpt_more', 'twentyeleven_auto_excerpt_more' );
I think it's obvious that PHP is not my strong point.
read more
link ?