By Eric Karkovack


If you’ve ever used the Posts area of WordPress, you’ve undoubtedly seen the Excerpt field. We know that an excerpt provides a nice way to summarize your blog post, news release or whatever else you’re posting to your website. What you may not realize is that, with a little tweaking, the excerpt can become a pretty powerful tool.

Why You Should Always Fill Out The Excerpt Field

Before we get into some helpful tweaks, I’m going to get up on my soapbox for a moment. Although I probably shouldn’t, I do get slightly annoyed when I set up a theme to take advantage of WordPress excerpts – only to see that the client doesn’t bother to fill them out.

While I don’t hold it in the same esteem as blinking text or pictures of sad clowns, leaving the excerpt field empty can have a negative effect on your website.

Entering a short summary of your post looks better than the automated excerpt WordPress generates by default (it just doesn’t look professional). It also can potentially help with SEO and make your site’s RSS feed and archive pages easier to read.

So, whether you copy and paste a sentence or two from the post or write a custom summary, please fill out that excerpt field. Now, on to the tweaks…

Allow Shortcodes in the Excerpt Field

Many worthwhile themes and plugins we’re using contain shortcodes, which are little bits of code that perform all sorts of useful functions. There may be times that you would want to use them in an excerpt. If so, just open up your theme’s functions.php file and add this code:

// Allow Shortcodes in the Excerpt field
 add_filter('the_excerpt', 'do_shortcode');

If you’re new to WordPress shortcodes, Tuts+ have published a tutorial that offers a detailed explanation of WordPress’ shortcode API and you will show you how to create a shortcode.

Limit the Length

By default, WordPress limits an excerpt to 55 words. Thankfully, that can be changed. Once again, open up your theme’s functions.php file and insert this code:

// Limit the amount of excerpt shown.
 function custom_excerpt_length( $length ) {
 return XX;
 add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );

Simply change the “XX” to whatever number of words you would like to allow.

Include HTML in Your Excerpt

This is always a popular request. After all, it can be frustrating when you’d simply like to have some bolded text, a link or some other HTML formatting included in an excerpt. There are a few ways to accomplish this.

If you’d prefer to use functions.php as we did above, you might add something like this.

If you’d rather use a plugin, Advanced Excerpt is a great solution. It provides a simple interface to customize how your excerpts are generated and will allow you to enable HTML (or even shortcodes, as discussed above).


WYSIWYG Excerpts

Adding HTML capabilities to your excerpts is nice – but what if you want to use the same visual editor that WordPress uses? That would open up even more possibilities and streamline the process of creating a custom excerpt.


The Rich Text Excerpts plugin comes in and does just that. It provides options for using  the “full” WordPress WYSIWYG editor, allow media uploads and even tweak the look of the excerpt field.

The Excerpt is Your Overlooked Friend

Excerpts can be so much more than just a little blurb of text. The ability to customize them can benefit everyone from novices to professionals. Just think of the different ways you might want to use them.

Have you done anything unique or interesting with WordPress excerpts? Leave a comment and let us know!

Themes are a huge part of what makes WordPress as popular as it is, and in this three-part Tuts+ tutorial series you’ll be taken through a step-by-step process that results in a completed, functioning WordPress theme.

Header & Social Image Source: Pixelated MVP by DacianLogan.

The post Extending the Functionality of WordPress Excerpts appeared first on Market Blog.

Read more here:: Extending the Functionality of WordPress Excerpts