Here’s a couple of useful functions which allow you to customize the appearance of the excerpts of your posts in the category and post lists. The standard output is […] and something like eighty odd words.

Using the first segment of code you are able to replace the brackets and dots with a link like the one below, or change it to something better for you. The second piece allows you to control the number of words in the excerpt.

// Replaces the excerpt "more" text by a link

add_filter('excerpt_more', 'new_excerpt_more');

function new_excerpt_more($more) {
       global $post;
	return '<a class="moretag" href="'. get_permalink($post->ID) . '"> Read More...</a>';
// Change number of words displayed in the excerpt

add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );

function custom_excerpt_length( $length ) {
	return 27;

Simply copy and paste this code into the functions.php file and it will do the rest. And you can obviously edit the code further to make it do precisely what you require.

Leave a Reply

Privacy & more..

Cookie Consent Policy