Events list widget showing events that have already started?

Home Forums Calendar Products Events Calendar PRO Events list widget showing events that have already started?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #765884
    thejoshevans
    Participant

    Hi,
    I’m currently using the Events List widget to show a couple of upcoming events in a sidebar, a number of these events are courses that run over a few months (I’ve set the event start/end date to show the full length of the course) but this seems to leave the course in the widget even after it has started.

    The course shows in the all courses list (which I’m happy for it to do so) but would like the widget to show just upcoming courses that are yet to begin.

    If there’s any way to do this I’d be very grateful for a nudge in the right direction!

    Also, I’ve just upgraded the Events Calendar to 3.7 but WordPress is now tell me the PRO add on is not compatible as it’s still sitting at 3.6.1. It isn’t showing an available update for the PRO add on so do I have to manually update it?

    Thanks

    Josh

    #767202
    Barry
    Member

    Hi Josh,

    What you’re describing – with regards to the list widget – is actually expected behaviour: when we query for upcoming events we also include current/ongoing events in the results for the simple reason that they have not yet finished, so most people still want them to appear.

    I do realize that’s not always ideal, though, and one quick and dirty solution you might try out is pasting the following code into your theme’s functions.php file:

    function tribe_list_widget_change_within_clause( $where ) {
    	remove_filter( 'posts_where', 'tribe_list_widget_change_within_clause', 20 );
    	$or_begins = strrpos( $where, 'OR (' );
    	$or_ends   = strpos( $where, ')', $or_begins );
    	return substr_replace( $where, '', $or_begins, $or_ends - $or_begins + 1 );
    }
    
    function tribe_list_widget_exclude_current_events( $query ) {
    	add_filter( 'posts_where', 'tribe_list_widget_change_within_clause', 20 );
    	return $query;
    }
    
    add_filter( 'tribe_events_list_widget_query_args', 'tribe_list_widget_exclude_current_events' );

    I do have to caution though that a WordPress installation can be a complicated environment, especially if multiple plugins are all modifying the database query (as can happen), so though I hope this is helpful I’m afraid I can offer no guarantee – though of course I’d love to hear back from you if it proves useful 🙂

    Also, I’ve just upgraded the Events Calendar to 3.7 but WordPress is now tell me the PRO add on is not compatible as it’s still sitting at 3.6.1. It isn’t showing an available update for the PRO add on so do I have to manually update it?

    So the first thing to check here is that you entered your license key (in Events > Settings > Licenses) – if everything looks correct there and you’re still having difficulties definitely let us know but it would be appreciated if you could do so in a new thread.

    Thanks again!

    #768127
    thejoshevans
    Participant

    That works perfectly! I may change the way I set up dates in the future as I’ve noticed that Google also show currently running events in the search snippets, but for now this is exactly what I was after.

    I had forgotten to enter my license, I did add them when I was running offline but not when my moved everything onto the server!

    Thanks again, the support for this product is always fantastic.

    #768420
    Barry
    Member

    Great to hear (and thanks for confirming that worked for you) 🙂

    Since it sounds like all is well I’ll go ahead and close this thread – but please don’t hesitate to create new threads as needed if we can help with anything else. Thanks again!

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Events list widget showing events that have already started?’ is closed to new replies.