Have you tried this out on your site? I think that if there’s no content to show, it won’t display anything at all. I suppose you could try this instead:
<?php
$my_query = new WP_Query('category_name=review&post_status=future&order=ASC');
// If there's content -- there's an IF statement added here
if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post();
$do_not_duplicate = $post->ID;
?>
** STUFF HERE ***
<?php endwhile;
// If there's no content -- here's the ELSE statement
else: ?>
<!-- Do stuff -->
<?php endif; ?>
I haven’t tested that, so let me know how it works.
Hi tsguitar,
Many, many thanks.
That worked a treat although I am not sure if I have put the opening <ul>
in the right place. If I put it in the query it will loop for every post. This is what I am using…
<ul>
<?php
$my_query = new WP_Query('category_name=review&post_status=future&order=ASC');
// If there's content -- there's an IF statement added here
if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post();
$do_not_duplicate = $post->ID;
?>
<li><?php the_time('l, M j, Y') ?>: <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
</ul>
<?php endwhile;
// If there's no content -- here's the ELSE statement
else: ?>
No gigs right now.
<?php endif; ?>
Again thankyou for your help.
Kind regards
Put the closing UL after the whole thing:
<?php endif; ?>
</ul>
And put “No gigs right now” inside an LI tag. That should do it.