[post_excerpt]

The shortcode displays an excerpt from a specific post or the current post.


Product


Shortcode Attributes

  1. id – Post ID whose excerpt you want to display. Not required if used for the current post.
    • Options: Any valid post ID.
  2. label – A label to display before the excerpt.
    • Options: Any text value.

Shortcode Enclosed Content

Any content placed between [post_excerpt] and [/post_excerpt] will be used as a template, where {content} acts as a placeholder for the post excerpt.


Example Usage

Example 1

[post_excerpt label="Excerpt:"]

Results

<label>Excerpt:</label> This is the post excerpt.
This example will display the excerpt with a label:
If the post does not have an excerpt, the shortcode will return an empty string.

Example 2

[post_excerpt]<div class="custom-excerpt">{content}</div>[/post_excerpt]

Results

<div class="custom-excerpt">Excerpt for the current post</div>
This example will display the excerpt with a custom wrapper.

Example 3

[post_excerpt id="123" label="Featured Post Excerpt:"]

Results

<label>Featured Post Excerpt:</label>
Excerpt for Post ID 123
This example will display the excerpt of a specific post with a label.