in WordPress

Change End Excerpt In WordPress

Wordpress is a popular blogging software that allows you complete freedom on how you display the posts to your visitors. It is common on most blogs to have a snippet of the post on the home page of the blog. Just like on this blog there is a excerpt of the posts on the home page, it will display the first 100 characters of the post then there will be a link for the visitor to view the whole page. In Wordpress this is easily done by using the the_excerpt() function. The Wordpress default will display the first 250 characters but you can change this to what ever you want by applying a filter to change the excerpt length. But the default the_excerpt() function will end the snippet of the post with a [...], which isn't the best looking with your design, so you can change this with the following code snippet. Copy the following into your functions.php file and you can change the [...] at the end of your excerpt.


/**
 * Replace the [...] wordpress puts in when using the the_excerpt() method.
 */
function new_excerpt_more($excerpt) 
{
    return '...';
}
add_filter('excerpt_more', 'new_excerpt_more');

Upgrade to access all content on Paulund

Members unlock all tutorials and snippets

Access to all downloadable content

Access to code examples before others

Sign Up Now

Already a member? Login here

Subscribe To The Weekly Newsletter

Get weekly updates to your email