If you use excerpts on your WordPress website, then there will be times when you might forget to add an excerpt or just might not need one. In these cases, nothing will be displayed under the title of your posts whenever they are listed.

To prevent this, you can add a default message/excerpt to be displayed when there’s no excerpt available.

$excerpt = get_the_excerpt();
if ( empty($excerpt) ) {
    echo "There is excerpt/summary available for this post.";
}
echo $excerpt;

Use this code wherever you use an excerpt in your theme.

Pin It on Pinterest

Share This