How to add a read more link to post excerpt in Hestia

When you fill the Excerpt box with any text on the post edit page, the_excerpt() function doesn't add any read more at the end of the short description. If you want to show the read more with post excerpt text, I'd recommend you create a child theme and add the following code in the functions.php file of your child theme.

function new_excerpt_more($more) {
    return '';
}
add_filter('excerpt_more', 'new_excerpt_more', 21 );

function the_excerpt_more_link( $excerpt ){
    $post = get_post();
    $excerpt .= '... <a href="'. get_permalink($post->ID) . '">Read more</a>.';
    return $excerpt;
}
add_filter( 'get_the_excerpt', 'the_excerpt_more_link', 21 );

If you want to do this only in the blog section of frontpage, you need to use the below code:

function new_excerpt_more($more) {
    return '';
}
add_filter('excerpt_more', 'new_excerpt_more', 21 );
function the_excerpt_more_link( $excerpt ){
    $post = get_post();
       if(is_front_page()){
     $excerpt .= '... <a href="'. get_permalink($post->ID) . '">Read More</a>.';
	}
    return $excerpt;
}
add_filter( 'get_the_excerpt', 'the_excerpt_more_link', 21 );
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us