Skip to content

How to Customize Manual or Auto Excerpt for WordPress

  • by
  • SEO
How to Customize Manual or Auto Excerpts

WordPress excerpt is not only a handy link for blog readers but also a wonderful way to show the summary of your content on the index page. In this article, I will talk about all the possible functions of the WordPress Excerpt. And, in the end, I will show you how to customize it for a twenty eleven child theme. So, if you are interested to know how to Customize a manual or auto excerpt for a WordPress theme keep reading the rest of this article.

You can put the excerpt manually or automatically. By default, WordPress allows putting manual excerpts from WordPress text editor. If you want to put a manual excerpt into your post, you can do it by placing a more tag just after the first paragraph while editing the post. You will find a button to doing this stuff easily in the WordPress default editor window. See the picture below for a live example:

How to add read more button to a WordPress Theme
How to add a Read more button manually to a WordPress Post

Change the text of the manual excerpt:

If you see that the default text of the manual excerpt is more or “Continue reading…” but you want to change this text to “Read more…” or your text you can try this code into your theme’s function.php file:

// Changing excerpt more - only works with Manual Excerpt 
add_filter('get_the_excerpt', 'manual_excerpt_more');
function manual_excerpt_more($excerpt) {
	$excerpt_more = '...';
	if( has_excerpt() ) {
    	$excerpt_more = ' <a href="'.get_permalink().'" rel="nofollow">[Read more]</a>';
	return $excerpt . $excerpt_more;

I hope you are now clear about the process of manual excerpts into WordPress. But if you don’t like to put the excerpt or read more button manually you can configure the specific template that generates your blog index page. Usually, index.php does this stuff. So at first, open your index.php file and find the code snippet:

<?php the_content(); ?>

and change it into:

<?php the_excerpt(); ?>

and now you will see the automatic output of the_excerpt tag that ended after every 50 words of your every post and you do not need to add more tag manually into your post.

Change the_excerpt Length:

Usually, auto excerpt length is 50 word but if you want to extend it into 100 words, simply place this code into your functions.php file:

// Changing excerpt length - only works with AUTO excerpt
add_filter('excerpt_length', 'my_excerpt_length');
function my_excerpt_length($length) {
	return 100;

Change the text of Auto excerpt:

By default, Auto excerpt ends with […] and if you want to change it as a text link just add this code to your functions.php file:

// Replaces the excerpt "more" text by a link
function my_excerpt_more($more) {
       global $post;
	return '<a class="moretag" href="'. get_permalink($post->ID) . '">...Read more</a>';
add_filter('excerpt_more', 'my_excerpt_more');

Now you will see that every post is ended with a “Read more” link at the end of your post on the main page.

Change the excerpt text for Twenty eleven:

I think now it is pretty simple to configure WordPress Excerpt or more tag for any WordPress theme. However, some of these codes are not working with some specific theme that already customizes the_excerpt function.

I found that It is tough to change or customize the function of manual or auto excerpt for Twenty eleven using the_excerpt template tag or more tag and then discover that Twenty Eleven theme already uses two functions for the_excerpt template tag named “twentyeleven_custom_excerpt_more” and “twentyeleven_auto_excerpt_more.

So, at first, I remove these functions from the child theme’s functions.php and use my functions to define the_excerpt tag.

The Final Code:

Here is the code that I use to remove Twenty eleven Excerpt Function’s from my child theme and implement my own function’s:

/********* CUSTOM EXCERPTS ************/
/* Removes the get_the_exerpt filter */
function gc_remove_excerpt_filter() {
   remove_filter( 'get_the_excerpt', 'twentyeleven_custom_excerpt_more' );
add_action( 'after_setup_theme', 'gc_remove_excerpt_filter' );
/* Adds a pretty "READ MORE" link to custom post excerpts  */
function gc_custom_excerpt_more( $output ) {
    if ( has_excerpt() && ! is_attachment() ) {
        $output .= continue_reading_link();
    return $output;
add_filter( 'get_the_excerpt', 'gc_custom_excerpt_more' );
/*********** AUTO EXCERPTS **********/
/* Removes the excerpt_more filter */
function gc_remove_auto_excerpt_filter() {
   remove_filter( 'excerpt_more', 'twentyeleven_auto_excerpt_more' );
add_action( 'after_setup_theme', 'gc_remove_auto_excerpt_filter' );
/* Adds a pretty "READ MORE" link to custom post excerpts. */
function gc_auto_excerpt_more( $more ) {
    return '...' . continue_reading_link();
add_filter( 'excerpt_more', 'gc_auto_excerpt_more' );
/* Returns a "READ MORE" link */
function continue_reading_link() {
   return ' <a class="read-more" href="'. get_permalink( get_the_ID() ) . '">Read More</a>';

I hope you will enjoy this code. Good Luck! If you want to change it by a plugin you can buy it from here:

Leave a Reply

Your email address will not be published. Required fields are marked *