• Resolved anonymized-3854925

    (@anonymized-3854925)


    Since upgrading this plugin and WP, I’ve noticed the following code no longer works:

    $args = array( 'posts_per_page' => -1,
    		'eventDisplay' => 'all'
    );
    
    $events = tribe_get_events( $args );

    The website I am using the plugin on has all of it’s events in the past, but we need them to display. So I’ve gone with the following code to get it to work:
    'eventDisplay' => 'past',

    However, I want to display both upcoming *and* past events. I don’t see a way to do this on your support pages however? It only seems to be one or the other? Or a particular custom date?

    https://wordpress.org/plugins/the-events-calendar/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter anonymized-3854925

    (@anonymized-3854925)

    I’ve managed to fix it with the following:

    $args = array( 'posts_per_page' => 3,
    	   'eventDisplay' => 'custom',
    	   'start_date' => '2014-01-01 00:01'
    );
    
    $events = tribe_get_events( $args );

    I was thinking I needed an end date in there too. Is this the best way to achieve what I’m after? By setting the start date before the first event in order to display past and upcoming events?

    Barry

    (@barryhughes-1)

    That looks like a good way to go.

    If you literally need all events, just make the date range really wide (start on 1900-01-01 and end 2100-12-31, or whatever is appropriate in your case) 🙂

    Thread Starter anonymized-3854925

    (@anonymized-3854925)

    ah okay thanks, that code that I’ve used though, wont that give me all of the events?

    It does seem a little odd to have to specify an end date 100 years in the future… seems a little cleaner to just specify only a start date on it’s own, provided that will work okay?

    hi pealo86 plz what page I will change put this code

    $args = array( ‘posts_per_page’ => 3,
    ‘eventDisplay’ => ‘custom’,
    ‘start_date’ => ‘2014-01-01 00:01’
    );

    $events = tribe_get_events( $args );

    Howdy Ben,

    Could you clarify your question? I do not quite understand, but maybe pealo does.

    Pealo your code will show any event since 2014. If all your events are for 2014 and foward, then yes it shows all of your events. 🙂

    Cheers!
    – Brook

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘'eventDisplay' => 'all' — no longer working’ is closed to new replies.