How to remove the suffix dot from the excerpt

Well, I’m sure those of you who are using WordPress themes that displays the excerpt wanted to know how can you remove the suffix dot from the excerpt. What is suffix dot from the excerpt? This little thing that appears after each partial content displayed on your index or archive page and it looks like this […]

You can install a plugin to remove those suffix dots but is it really necessary? It is just a matter of copy and paste of one of the following codes in your “functions.php” file that is located in the folder of your WordPress theme. Let’s get started:

Method 1. If you want to complete remove the suffix dot add the following code to functions.php

function trim_excerpt($text)
{
return rtrim($text,'[...]');
}
add_filter('get_the_excerpt', 'trim_excerpt');

Method 2. If you want to change the […] with this … add the following code to your functions.php

function trim_excerpt($text)
{
return str_replace(' [...]', '...', $text);
}
add_filter('get_the_excerpt', 'trim_excerpt');

Method 3. If you want to change the suffix dot with a “read more” link, than add this code to your functions.php file:

function trim_excerpt($text)
{
return str_replace(' [...]', '<a href=" . get_permalink() . ">' . ' read more...</a>', $text);
}
add_filter('get_the_excerpt', 'trim_excerpt');

That’s about it… you really don’t need a plugin for this.

1 responses on "How to remove the suffix dot from the excerpt"

  1. Thanks for the advice, it saves a lot load time not bother with a plugin, i have used method two which works fine but could not get method three to function but it could be my template.

Leave a Reply

top
Template Design © VibeThemes. All rights reserved.

Privacy Preference Center

Necessary

This cookie is set when you login to your account at VibeThemes. VibeThemes based on WordPress sets this cookie, which indicates when you're logged in, and who you are, for most interface use.

WordPress uses the two cookies to bypass the password entry portion of wp-login.php. If WordPress recognizes that you have valid, non-expired cookies, you go directly to the WordPress Administration interface. If you don't have the cookies, or they're expired, or in some other way invalid (like you edited them manually for some reason), WordPress will require you to log in again, in order to obtain new cookies.

wordpress_logged_in_[hash],wp-settings-{time}-[UID]

Advertising

Analytics

Comments

When you comment on VibeThemes blog, they too get cookies stored on their computer. This is purely a convenience, so that the visitor won't need to re-type all their information again when they want to leave another comment.
The commenter cookies are set to expire a little under one year from the time they're set.

comment_author_{HASH},comment_author_email_{HASH},comment_author_url_{HASH},

%d bloggers like this: