Support » Plugin: The Events Calendar » [Plugin: The Events Calendar] Custom Category Display Conditional Logic Help

  • I am using the following code to display a specific event category in one of my site’s sidebars.

    <div class="widget">
    			global $post;
    				$all_events = tribe_get_events(
    					'tax_query'=> array(
    					'taxonomy' => 'tribe_events_cat',
    					'field' => 'slug',
    					'terms' => 'willow-creek-events'
    			foreach($all_events as $post) {
    			<span class="event-date" style="color:#666;"><a href="<?php the_permalink(); ?>"><?php echo tribe_get_start_date($post->ID, true, 'M j, Y'); ?></a></span>
    			<em><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></em>
    			<?php } //endforeach ?>
    			<?php wp_reset_query(); ?>
    					<div class="dig-in" style="font-family: Georgia, Times, serif; font-style: italic; text-transform: lowercase;
    		font-size: 12px; color:#ccc;">
    					<a href="">View all events</a>

    How could I use conditional If / Else logic to to display a default message if there is no event for the current category?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Rob La Gatta


    Hey derek. I’m not sure about the level of effort required for this (it may be fairly complex), but have asked our dev Jonah to take a look to see if he can point you in the right direction. No guarantees but if it’s straightforward enough we will see what we can do.

    In the interim, if you haven’t checked out our documentation at, you may find some information that is generally useful as you continue to use the plugin. Thanks for your support so far.



    Thank you so much for the reply. I would love to get some feedback on your thoughts for the most efficient way of achieving this.

    In the meantime I worked up a solution that is working for me. You can check it out here:


    Plugin Author Rob La Gatta


    Awesome to hear this solution did the trick. When Jonah takes a look (should be today sometime) I’ll get him to comment as to the solution and whether it seems viable for the long term. Cheers!



    Hey derekshirk,

    That’s a perfectly valid chunk of code, the only thing I would change is using WP_Query instead of query_posts

    See this for an explanation:


Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: The Events Calendar] Custom Category Display Conditional Logic Help’ is closed to new replies.