WordPress If Excerpts Else Content

Hi Friends, Going to write down a simple code block of WordPress which will show experts if excerpts exists else show content. So in simple way you can say WordPress If Excerpt else content.

Below is code :

<?php
if($post->post_excerpt) {
the_excerpt();
} else {
the_content();
}
?>

So above code can be used and it will show excerpt if excerpt exists else it will show content. I hope this small code will be helpful for someone.

I am PHP FreelancerHire WordPress Developer India and Hire WordPress Programmer. If you have any projects related to WordPress or PHP you can contact me.

2 Comments

  • Tim April 16, 2014 Reply

    Thanks

  • Amy June 27, 2014 Reply

    Thank you! Just what this newbie needed.

Leave a Reply