Blog for web designers

Check if the_content is empty

In this short tutorial I am going to show you how you can easily check if the_content is empty or not. Well sometimes adding demo content in all page is really a big headache. But you don’t have a choice if your clients says it to do so. Adding demo content in all page to see everything look fill. We will do that in a page.php or any other cms page template you have defined.

Check if the_content is empty


if($post->post_content=="")
{
//whatever you want to be there if there is no content
} else {
the_content();
}

Santosh Shah

My name is Santosh Shah and blogs at santosh-shah.com


Reader Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.