WordPress.org

Ready to get started?Download WordPress

Forums

WP_query problem (3 posts)

  1. elyonline
    Member
    Posted 6 years ago #

    Hi there,

    I am trying to do a future post query but am unsure how I would put a 'sorry no gigs currently planned' if no future gigs are present. This is what I am currently using for the query.

    <ul>
    	<?php
    	$my_query = new WP_Query('category_name=live-review&post_status=future&order=ASC');
    	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;?>

    Thanks
    Karl

  2. Thatedeguy
    Member
    Posted 6 years ago #

    you should be able to do a second half of the while loop or add an if statement in there to add that text.

    I'm not sure if the exact syntax of the code though so I can't help with writing it.

  3. elyonline
    Member
    Posted 6 years ago #

    Thanks for that, it is (indeed) the syntax for this I am struggling with. Is anyone able to give me a nod in the right direction please?

    Thank you
    Karl

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.