Du musst dich anmelden um Beiträge und Themen zu erstellen. Einloggen · Registrieren

Differentiate Between Posts Depending on Presence of Excerpt


Here is a quick conditional snippet that displays different content depending on the presence of an excerpt:

<?php if(!empty($post->post_excerpt)) {

	// this post has an excerpt, so display it:

} else {

	// this post has no excerpt, so display something else instead:

} ?>

Placed inside the loop, this code will check each post for an excerpt. If one is found, the excerpt is displayed; otherwise, the code specified in the else condition is displayed.