Replace … with “Read More” link or button

In the alternate thumbnails layout, the default display shows the excerpt with a […] at the end. The thumbnail and the title are linked to the post. If you want to add a “Read More” link or a “Read More” button, here is how your do it.

To replace the […] with a [Read More] link, add this to your child theme’s functions.php

function new_excerpt_more($more) {
    global $post;
    return ' <a class="moretag" href="'. get_permalink($post->ID) . '">[Read More]</a>'; //Change to suit your needs
}

add_filter( 'excerpt_more', 'new_excerpt_more' );

 

To replace the […] with a Read More button, add this to your child theme’s functions.php

function new_excerpt_more($more) {
    global $post;
    return ' <a class="moretag btn btn-primary" href="'. get_permalink($post->ID) . '">Read More »</a>'; //Change to suit your needs
}

add_filter( 'excerpt_more', 'new_excerpt_more' );

 

10 thoughts on “Replace … with “Read More” link or button”

Comments are closed.