help with WP_Query code
-
on this page i have this code which pulls in the Upcoming Events category post titles:
<h2>Gold Coast Chamber Upcoming Events</h2> Coming Soon... <?php $loop = new WP_Query( array( 'category_name' => 'Events', 'orderby' => 'meta_value', 'meta_key' => 'eventdate', 'order' => ASC) ); while ( $loop->have_posts() ) : $loop->the_post(); ?> <div class="sing-event"> <p class="up-events"><a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></p> <div id="teaser"><img src="<?php $thumb = get_post_custom_values('teaser'); echo $thumb[0]; ?>" alt="<?php the_title(); ?>" /></div></div> <?php endwhile; ?>
We don’t have any posts from that category at the moment so I inserted the text “Coming Soon…” but i’m wondering how I could fit that Coming Soon… into the code so that it gets auto-generated when there’s no posts in that category.
any idea? please advise. thanks in advance!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘help with WP_Query code’ is closed to new replies.