How to add a read more link to post excerpt in Hestia
When you enter text in the Excerpt box on the post edit page, WordPress uses that manual excerpt instead of Hestia's automatically generated excerpt. As a result, Hestia doesn't automatically shorten the text or add a Read More link.
If you don't need a custom excerpt, clear the text from the Excerpt box and update the post. For posts shown in Hestia's front-page Blog section, Hestia then creates a preview from the post content, displays up to 35 words, and adds a Read More link.
If you want to keep your manually written excerpt and also display a Read More link, create a child theme and add the following code to its functions.php file.
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 );