Spiral notebook with handwritten text and a pen on wooden surface for note-taking.

Making Your Own Excerpts

| ,

There are plenty of reasons that you would want to use excerpts of posts. If you run a site that has a lot of lengthy posts, and want each to be showcased individually, then your posts page may benefit from the use of excerpts for display. An excerpt is a short intro to the post, usually ending with a “read more” link to the full text.

The default excerpt in wordpress is the first 55 words of the post, which works in some cases, but not all. For one thing, maybe you have an intro that you want to showcase, or maybe you want it to not break too soon or too late from the text. In that case, you could use a plugin (such as the aptly named Excerpt Editor). Some plugins even allow for thumbnails for posts, and meta-tag editors for SEO purposes.

If you just want to have a different length of the excerpt, but don’t need to choose custom ones, or want them to be bigger or smaller to fit a layout that you have in mind, this can be changed in your functions.php file of your theme. Open that file in your editor and add this:

function custom_excerpt_length( $length ) {
    return 55;
}
add_filter( 'excerpt_length', 'custom_excerpt_length');
 
 
function custom_excerpt_more( $more ) {
    return '...Read More';
}
add_filter( 'excerpt_more', 'custom_excerpt_more' );

The “return 55” is the length in words of your excerpt, so change 55 to whatever length you want the excerpt to be. “return ‘…Read More’;” tells the link to the full text of the post after the excerpt to say “…Read More”, and can also be changed to whatever you like.

If you have any other questions about how to change excerpts, feel free to leave a comment!

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Your post must include a link to this post.

How does this work?
Write a response on your own website and include a link to this post. Then submit your response’s URL here. Your response may appear here after moderation. To update or remove it, edit or delete your original post and submit the same URL again. Learn more about Webmentions.
🌙 ☀️