How to: Check out if a post has an excerpt

How to be able to know if a specific post has an excerpt? It may seems hard at first because there’s no built-in WordPress function to achieve it, but I got this useful code which make it possible.

To check out if a post has an excerpt, simply paste the following code within the loop:

<?php if(!empty($post->post_excerpt)) {
     //This post have an excerpt, let's display it
     the_excerpt();
 } else {
     // This post have no excerpt
 } ?>

That's all! Hope it helps!

Leave a Comment

* Name, Email, Comment are Required