X

Conditionally display default content if there is no post content

If you have a website where users submit posts and sometimes they don’t bother typing in some content then this will be useful to remind them when they read their post.

Add this above or below the tag in single.php

Code Snippet:

<?php if( empty( $post->post_content) ) { ?> 
Please take the time to include some content... thanks!
<?php } else { ?>
<?php } ?>

Comments  Leave a Reply

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!