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">
    		<ul>
    
    			<?php
    
    			global $post;
    				$all_events = tribe_get_events(
    				array(
    					'eventDisplay'=>'upcoming',
    					'posts_per_page'=>10,
    					'tax_query'=> array(
    				array(
    					'taxonomy' => 'tribe_events_cat',
    					'field' => 'slug',
    					'terms' => 'willow-creek-events'
    					)
    					)
    				)
    			);
    
    			foreach($all_events as $post) {
    			setup_postdata($post);
    			?>
    
    			<li>
    
    			<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>
    			<br/>
    
    			<em><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></em>
    
    			</li>
    
    			<?php } //endforeach ?>
    			<?php wp_reset_query(); ?>
    		</ul>
    
    					<div class="dig-in" style="font-family: Georgia, Times, serif; font-style: italic; text-transform: lowercase;
    		font-size: 12px; color:#ccc;">
    					<a href="http://bond.pcc.edu/dev/upcoming-events/category/cascade-events/">View all events</a>
    					</div>
    		</div>

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

    http://wordpress.org/extend/plugins/the-events-calendar/

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

    (@roblagatta)

    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 http://tri.be/support/documentation, you may find some information that is generally useful as you continue to use the plugin. Thanks for your support so far.

    derekshirk

    (@derekshirk)

    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:

    http://snippi.com/s/y0wu903

    Cheers,

    Plugin Author Rob La Gatta

    (@roblagatta)

    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!

    jonahcoyote

    (@jonahcoyote)

    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:
    http://wordpress.stackexchange.com/questions/1753/when-should-you-use-wp-query-vs-query-posts-vs-get-posts

    Cheers,
    Jonah

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.