How to Use the Excerpt as a Description

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

  • It replaces the full content in RSS feeds when the option to display summaries is selected in Dashboard › Settings › Reading.
  • 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.

Disclosure: Some of the links in this article are affiliate links and we may earn a small commission if you make a purchase, which helps us to keep delivering quality content to you. Here is our disclosure policy.

Noor Mustafa Raza
Noor Mustafa Raza
I am a WordPress Developer and Designer, author @WPArena. I am providing Free WordPress consultation and can help you to install WordPress in a secure way to small businesses and bloggers.

LEAVE A REPLY

Please enter your comment!
Please enter your name here
Captcha verification failed!
CAPTCHA user score failed. Please contact us!

spot_img

Related Articles

Why Custom Software Development Drives Business Success

Companies desire software solutions that are specifically designed to their specific processes and objectives in today's high-speed virtual world.  While...
Read More
We started WPArena back in 2008 and we had one main goal: teaching people how to be successful with WordPress....
Imagine walking into a library where books are scattered everywhere with no rhyme or reason. Frustrating, right? The same goes...