Determines whether the post has a custom excerpt.
Description
For more information on this and similar theme functions, check out the Conditional Tags article in the Theme Developer Handbook.
Parameters
Source
function has_excerpt( $post = 0 ) {
$post = get_post( $post );
return ( ! empty( $post->post_excerpt ) );
}
Changelog
Version | Description |
---|---|
2.3.0 | Introduced. |
When you need to hide the auto displayed excerpt and only display your post’s excerpts.
Test for presence of excerpt in a post.
Below code determines whether the post has an excerpt. If excerpt not found, then it will display the first 200 characters for the current post.
Replace auto excerpt with text or code.