How to Use the Excerpt as a Description

Nur . Posted in How-To 1384 Views

The WordPress Excerpt is an optional summary or description of a post; in short, a post summary.
The Excerpt has two main uses: (WordPress Excerpt)

1. It replaces the full content in RSS feeds when the option to display summaries is selected in Dashboard › Settings › Reading.
2. Depending on the WordPress theme, it can be displayed in places where quick summaries are preferable to full content:
* Search results
* Tag archives
* Category archives
* Monthly archives
* Author archives

How to add excerpts to posts

To add an excerpt to a post, simply write one in the Excerpt field under the post edit box. An excerpt can be as short or as long as you wish. Usually, given its purpose, a couple of sentences is fine.
Interestingly, since the WordPress excerpt is similar in purpose to the META description of (X)HTML documents, excerpts can additionally be used as meta descriptions too. Some themes do this by default. It can also be done by means of an SEO plugin or a plugin for managing data in the head of (X)HTML pages.

Since the_excerpt() prints directly to the screen and can’t be passed to other PHP functions, you can’t wrap it in the esc_attr() function, as you normally would when using a template tag as an HTML attribute. Instead, you use the_excerpt_rss(). This function formats the excerpt for RSS feeds, but in this case it will work equally well in your description attribute, since excerpts can’t contain HTML.

Add this lines code between the <head></head> tags in the header.php file of your WordPress theme, which display the excerpt as the meta description tag for single posts and pages.

<?php
if (is_singular()):
global $post;
setup_postdata($post);
?>
<meta name=”description” content=”<?php the_excerpt_rss(); ?>” />
<?php endif; ?>

I have not discussed The WordPress Excerpt in detail but rather explained most important part. I tried to make some sense of it by focusing on what seemed essential to me and without going into too much detail. If you think there is still too much detail, or not enough detail, leave a comment to say so. If you are still satisfied read the following reference and I hope you will find WordPress Excerpt in detail.

Useful Resources:

The manual Excerpt in WordPress
Ultimate Guide to WordPress SEO – META Descriptions
How to use the Excerpt field from WordPress for SEO
WordPress meta description using post excerpt, category description and post ID
The WordPress excerpt: What, why, how, tips and plugins
Using WordPress Excerpts
Change excerpt length in wordpress

WordPress Top Plugins

Digging Into WordPress

WordPress 3.0 jQuery: Enhance your WordPress website

Nur

I am a Wordpress, Website Developer and Designer, creator @ WP Arena, Provide Free WordPress consultation and can help to install WordPress in a secure way to small businesses and bloggers.
  • http://wprev.com WPrev

    Thanks for sharing! Is fine, everyone can understand what is about enough details :)

  • http://www.wordpressformusicians.com Mario

    Nice article, the excerpt is so under used has a huge benefit. I have seen my search results get a little better with more concise descriptions.

Free & Professional WordPress Security Service Free & Professional WordPress Security Service

We Love WordPress. WordPress Arena is a place for WordPress Developers and Designers, providing Tips, tricks, tools and resources to build a website or blog on WordPress. We also present The WordPress Showcase for all kind of WordPress Powered Websites.


Copyright © 2014 WP Arena All Rights Reserved

Divi WordPress Theme