Removing expired events

Home Forums Calendar Products Events Calendar PRO Removing expired events

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1070269
    Robert
    Participant

    My question is 2 fold.

    1. Is there a way to have expired events removed from the calendar after X amount of time?

    2. I created a list style of events that show the next upcoming events and it sits on top of my calendar as shown here below (/upcoming-events).

    tribe_get_template_part( 'month/upcoming-events' );

    // Tribe Bar
    tribe_get_template_part( 'modules/bar' );

    // Main Events Content
    tribe_get_template_part( 'month/content' );

    do_action( 'tribe_events_after_template' );

    In this event view it’s showing events that have past already in January, e.g. http://cl.ly/1d1F3A0r2F2S

    Is there a way to make it so that it doesn’t show these events since they’ve already past? Below is my code for the upcoming events list.


    global $post;

    // Retrieve the next 5 upcoming events
    $events = tribe_get_events( array(
    'posts_per_page' => 5,
    //'start_date' => new DateTime()
    ) );

    echo '<ul id="upcoming-events">';

    // Loop through the events: set up each one as
    // the current post then use template tags to
    // display the title and content
    foreach ( $events as $post ) {
    setup_postdata( $post );

    echo '

  • ';

    // This time, let's throw in an event-specific
    // template tag to show the date after the title!
    echo ''; echo the_title(); echo '';
    echo '<br />';
    echo 'When: ' . tribe_get_start_date();
    echo '<br />';
    echo 'Where: ' . tribe_get_venue(); if (tribe_get_city() !='') : echo ' - ' . tribe_get_city(); endif; if (tribe_get_state() !='') : echo ', ' . tribe_get_state(); endif;
    //echo tribe_get_city();

    echo '<br />';

    echo '

  • ';
    }

    echo '';

    ?>

    View all upcoming events

#1070503
Geoff B.
Member

Good evening Lindsay and welcome back!

Thank you for reaching out to us.
We will gladly try to assist you on these topics.

1. Is there a way to have expired events removed from the calendar after X amount of time?

The short answer is yes. Depending on how forceful you want to be, you can:

Is there a way to make it so that it doesn’t show these events since they’ve already past? Below is my code for the upcoming events list.

Perhaps you can draw inspiration from my colleague Barry as explained in the following post ?

Let me know if that helps.

Have a great day!

Geoff B.

 

#1081495
Support Droid
Keymaster

This topic has not been active for quite some time and will now be closed.

If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Removing expired events’ is closed to new replies.