Past Course Feed

Home Forums Calendar Products Events Calendar PRO Past Course Feed

  • This topic has 3 replies, 2 voices, and was last updated 8 years ago by Josh.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1114896
    Chris
    Participant

    Im using the following to output a feed of previous (past) courses in specific categories (i.e. mexico) but it only outputs the most recent past events regardless of category:

    // Ensure the global $post variable is in scope
    global $post;
    // Retrieve 2 Past Events
    $events = tribe_get_events( array(
    'taxonomy' => TribeEvents::TAXONOMY,
    'eventDisplay' => 'past',
    'posts_per_page' => 2,
    'order' => 'DESC',
    'terms' =>array('Mexico'),
    'operator'=>'IN'

    ) );

    #1115190
    Josh
    Participant

    Hey Chris,

    Thanks for reaching out to us!

    Try modifying that query to utilize a tax_query and see if that helps to address the issue here.

    Let me know if this helps.

    Thanks!

    #1115258
    Chris
    Participant

    SORTED!

    Thanks for your guidance:

    <?php
    // Ensure the global $post variable is in scope
    global $post; 
    // Retrieve 2 Past Events
    $args = array (
    	'post_type' => 'tribe_events',
    	'eventDisplay' => 'past',
    	'posts_per_page' => 2,
    	'order' => 'DESC',
    	'tax_query'  => array(
    			array(
    				'taxonomy' => TribeEvents::TAXONOMY, 
    				'field' => 'slug',
    				'terms' => array('london-butler-school-courses'),
    				'operator'=>'IN'	,
    				
    			),
    	),
    );
    
    $events = tribe_get_events( $args );
      
    
    // Loop through the events: set up each one
    foreach ( $events as $post ) {
        setup_postdata( $post ); 
    ?>	
    • This reply was modified 8 years ago by Chris.
    #1115872
    Josh
    Participant

    Hey Chris,

    Awesome! I’m glad we were able to help get this one sorted for you!

    I’ll go ahead and close this thread for now. If you have any further questions, please don’t hesitate to open a new one.

    Thanks!

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Past Course Feed’ is closed to new replies.