Check out if a wordpress post has an excerpt

December 9, 2008 · Print This Article

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 we 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
} ?>


Your choice for site templates and wordpress themes

Comments

Got something to say?

You must be logged in to post a comment.