events in upcoming
-
I want to display new and past event only when [upcoming] is displayed in the list display.
Is there a way to separate only [upcoming] with an if statement?
-
This topic was modified 4 years, 3 months ago by
homme4.
-
This topic was modified 4 years, 3 months ago by
-
I tried to divide the conditions upcoming and others(eventcategory, past, eventcategory’past) in list by url.
As below.
<?php $url = $_SERVER['REQUEST_URI']; $search0 = '/category/'; $search1 = '/eventDisplay=past/'; if(preg_match($search0,$url)): //Match category elseif(preg_match($search1,$url)): if(preg_match($search0,$url)): //Match category&past endif; //Match past else: //Match upcoming ?>But It doesn’t work //Match category&past.
Is there a way to separate it by something other than the URL?Hi @homme4
If you’d like to have past events and upcoming events on the same page, that will require some additional customization on your part.
The best way to show past events with upcoming events is to create a template override of the template you are using and create a custom query using the tribe_get_events() function. The function works a lot like the WordPress get_posts() function, so you could use something like this:
<?php global $post; $all_events = tribe_get_events(array( 'eventDisplay' => 'all', 'posts_per_page' => 10, )); ?>Another option is to use add a filter to your theme’s functions.php file that adds past events to your list of upcoming events. That solution is outlined in this thread.
I hope that helps!
Thanks,
JaimeThanks for replying.
I was able to display the list!
The topic ‘events in upcoming’ is closed to new replies.