0

I want to query the event, but I don't know how to query only the first instance of the Recurring Event, Since my code query all the event, and it looks like a mess on the archive page, I just want to query the first instance.

$args = [
          'posts_per_page' => 999,
          'order'   => 'DESC',
          'tax_query' => [
                  [
                      'taxonomy' => 'tribe_events_cat',
                      'field' => 'slug',
                      'terms' => 'free-course',
                      'operator' => 'NOT IN'
                  ]
              ],
          ];

          $Eventlistings = tribe_get_events($args);
Dharman
  • 30,962
  • 25
  • 85
  • 135
  • You only want one post/item to be returned? If so, just change 'posts_per_page' to 1. – Jarvic Jul 07 '21 at 10:17
  • Thanks for answering but there is another event in the list too, and they also have recurring event, if we use 'posts_per_page' to 1, it only show 1 – Huy Nguyen Quang Jul 07 '21 at 10:41

1 Answers1

0
'posts_per_page' => 1

or you can take first instance like this

$Eventlistings->posts[0];
  • Thanks for answering but there is another kind of event in the list too, and they also have recurring event, this won't work for me – Huy Nguyen Quang Jul 07 '21 at 10:45
  • Sorry didnt' understand your question I don't have PRO version of Event Calendar but did you check this?https://clicknathan.com/web-design/events-calendar-pro-recurring-event/ – Boris Volkovich Jul 07 '21 at 11:53