How to Display a Read More link in WordPress Excerpts

The excerpt is trimmed down version of post content used to display a short description of post on blog, category and archive pages. By default,  WordPress sets […] as excerpt more string at the end of each excerpt. We can easily replace these dots with a read more link by using excerpt_more hook.

Must Read : How to Add Class to First Post in the WordPress Loop

To add a read more link at the end of each excerpt copy the following code and paste it inside your functions.php file.

function new_excerpt_more( $more ) {
	return ' <a class="read-more" href="' . get_permalink( get_the_ID() ) . '">' . __( 'Read More', 'your-text-domain' ) . '</a>';
}
add_filter( 'excerpt_more', 'new_excerpt_more' );

 

 

0 Comments

Leave a Comment.