WordPress if the Content is populated

<?php if($post->post_content=="") { //whatever you want to be there if there is no content } else { if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="summary"> <?php the_content(); ?> </div> <?php endwhile; ?> <?php endif; }?>
If you are using a container div that you don't want to show if the content is not populate this will also not render the container div unless there is content in the the default WP content editor.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.