How to check if a post has the Excerpt field filled manually



the_excerpt( ) displays the content filled in the Excerpt field (if filled manually) or else it will display an automatic excerpt which refers to the first 55 words of the post’s content.

To check if the Excerpt was manually filled, wordpress has a function called has_excerpt( ). So, if you dont like WP’s auto-excerpt, you can write a few lines of code like:

1
2
3
4
5
<?php if ( has_excerpt( ) ) {
    the_excerpt();
} else {
    the_content();
} ?>

Posted by

Deepak Thomas is a guy who hearts wordpress. If you're having trouble with wordpress, tweet it with @thinkdj and he'll try to solve your queries for a box of chocolates.

Leave a Reply

Required fields are marked *.


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>