Select Page

If you use excerpts on your WordPress site, you might have noticed that some of them end abruptly and don’t look good. Here’s an easy way to add three dots (…) at the end of every excerpt on your blog.

If an excerpt looks like this right now:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum consequat ut ex vitae mattis. Proin posuere augue in fermentum dictum. Ut sem augue, vulputate in hendrerit ac

It would look like this after using our code snippet:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum consequat ut ex vitae mattis. Proin posuere augue in fermentum dictum. Ut sem augue, vulputate in hendrerit ac…

Add this code to your theme’s functions.php file or to a custom plugin file:

function add_three_dots_to_excerpt($excerpt) {
    return $excerpt . '...';
}
add_filter('the_excerpt', 'add_three_dots_to_excerpt');