[Plugin: The Event Calendar PRO] Show an event on front page or echo something
-
I am trying to show a n event on the front page from a category and if it doesn’t exist echo coming soon, but it doesn’t show anything if the category has no post. Here is my code:
<?php global $post; $all_events = tribe_get_events( array( 'eventDisplay'=>'all', 'posts_per_page'=>1, 'tax_query'=> array( array( 'taxonomy' => 'tribe_events_cat', 'field' => 'slug', 'terms' => 'featured' ) ) ) ); foreach($all_events as $post) { setup_postdata($post); ?> <div id="column1"> <div id="colthum"><img src="<?php echo bloginfo('template_url'); ?>/images/JrHigh.png" /></div> <?php if (have_posts()) { ?> <div id="column1in"> <h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?> - <?php echo tribe_get_start_date($post->ID, true, 'M j, Y'); ?></h4> <?php the_excerpt(); ?></a> </div> </div> <?php } else { ?> <div id="column1in"> echo 'Coming Soon'; </div> <?php } ?> <?php } //endforeach ?> <?php wp_reset_query(); ?>
- The topic ‘[Plugin: The Event Calendar PRO] Show an event on front page or echo something’ is closed to new replies.