• There are two examples of Upcoming events in the tutorial (for TEC and Sugar Event Calendar), which I really need to use with the EventPrime plug-in. After adding a program in functions.php and changing the post type to em_event and meta_key to em_start_data_time, all expired events will still be displayed.

    function be_dps_event_query( $args, $atts ) {
      if( empty( $args['post_type'] ) || 'em_event' != $args['post_type'] )
        return $args;
        
      $args['orderby'] = 'meta_value_num';
      $args['meta_key'] = 'em_event_date_time';
      $args['order'] = 'ASC';
        
      $meta_query = array(
        array(
          'key' => 'em_event_date_time',
          'value' => time(),
          'compare' => '>',
        )
      );
      
      $args['meta_query'] = $meta_query;
      return $args;
    }
    add_filter( 'display_posts_shortcode_args', 'be_dps_event_query', 10, 2 );
    [display-posts post_type="em_event" meta_key="em_start_date_time" orderby="meta_value_num" order="ASC"]

    In addition, the current version of TheEventCalendar 6.x no longer needs to add shortcut arguments. As long as [display-posts post_type=”tribe_events”] is directly used, expired events will automatically not appear.

  • The topic ‘Upcoming events from EventPrime’ is closed to new replies.