spstieng
Member
Posted 3 years ago #
I have a page.
One of the default attributes of the page, is the 'Page' window where u enter your blog text.
To display the content, I use the the_content() function in the follwoing code:
if (have_posts()): while (have_posts()): the_post();
echo '<div class="ui-tabs-panel">';
the_content(); '<br />';
echo '</div>';
endwhile; endif;
Question: How can I avoid displaying an empty 'ui-tabs-panel' if there is no test in the 'Page' attribute (empty content) ?
spstieng
Member
Posted 3 years ago #
Ups, spelling mistake.
It should be 'if there is no text'
hi,
i don't have anywhere to test this at the moment but you might do this.
if (have_posts()): while (have_posts()): the_post();
if($post->content=="")
{
//whatever you want to be there if there is no content
}
else
{
echo('<div class="ui-tabs-panel">');
the_content(); '
');
echo('</div>');
}
endwhile; endif;
spstieng
Member
Posted 3 years ago #
Thanks jrm213, but that didn't work :(
I tried looking in Function Reference to see if there is anything there I can use. But didn\t find anything.
Where can I see what properties 'post' has?
spstieng
Member
Posted 3 years ago #
Anyone got any suggestions for this?
MartyThornley
Member
Posted 2 years ago #
I was looking for the answer to this too. You were on the right track but missing a word.
It should be $post->post_content like this:
<?php if($post->post_content=="") : ?>
<!-- Do stuff with empty posts (or leave blank to skip empty posts) -->
<?php else : ?>
<!-- Do stuff to posts with content -->
<?php endif; ?>