Summary Length


I don’t seem to be able to adjust the summary length of the blog posts on my home page.

I have gone through the normal route of settings > Reading > Summary but that doesn’t seem to have made a difference.

I can’t see an “excerpt” script within your functions.php file either. Can you please tell me the best way to do this?

By default the_excerpt function used in WordPress uses 55 words but you can adjust it manually by adding text directly to Excerpt field which you can see under each post/page when editing it. Any text you add there will be used as excerpt for blog no matter how short or long it will be.

Other option is to implement excerpt filter via Child Theme functions.php which would look something like this:

function custom_excerpt_length( $length ) {
	return 20;
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );


I have been playing around with this for a little while now and have constructed the following .php file for the child theme but seem to be getting something wrong. I get the error that:

Name Description
sparkling-child Stylesheet is missing.

This is the code I’ve used:

 Theme Name:   sparkling
 Description:  sparkling theme
 Author:       Colorlib
 Author URI:
 Template:     sparkling
 Version:      1.0.0
 Text Domain:  sparkling

@import url("../sparkling/style.css");

/* =Theme customization starts here
-------------------------------------------------------------- */

<?php //Opening PHP tag

// Custom Function to Include
function custom_excerpt_length( $length ) {
	return 20;
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );

?> //Closing PHP tag

Ok, realised how stupid that was.

I’ve created the style.css file separately now and the child theme is working fine, however the php file doesn’t seem to affecting any change in the post length.

I’ve also tried the excerpt field separately, but that doesn’t do anything either.

Is your php file called functions.php and nothing else? And do you have Child Theme activated instead of parent theme?

If so, could you please post your website URL and I will have a look what you have done there.

Yes, the child theme is working just fine. The functions.php file is called as such and the code in that file is:

<?php //Opening PHP tag

// Custom Function to Include
function custom_excerpt_length( $length ) {
return 10;
add_filter( ‘excerpt_length’, ‘custom_excerpt_length’, 999 );


This is the address: (a little NSFW)

Ok, now I see!

Copy paste content.php file from parent theme folder to Child Theme folder.

Once you are done, replace <?php the_content(); ?> with <?php the_excerpt(); ?>

Now you will be able to control content length via function mentioned above.

Nice first image on your blog :slight_smile:

Haha. Thanks :wink:

But should I keep the name of the file as content.php?

Ok, excellent, figured it out and it’s working just fine. only problem is that the image has gone from the home page now. Is there any way to keep the image there?

Set is as featured image like I have in theme demo:

Otherwise excerpt doesn’t allow any html styling and content. Other option is to use default full content display and use <!–more–> tag like this theme was originally designed to be used.