Show Past Events if There are no Upcoming Ones

Home Forums Calendar Products Events Calendar PRO Show Past Events if There are no Upcoming Ones

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1199868
    Stuart
    Participant

    I am using Photo as my default calendar view. Can you tell me how to set it to show Previous Events if no upcoming events are available please.

    Also, I have set the page to use my template that has no sidebar. Whilst it is using it, it seems to be loading in another default template too. Any ideas?

    Site is in development by the way!

    #1200294
    Geoff
    Member

    Hi @Stuart,

    Welcome to the forums! I hope you’ve been enjoying Events Calendar PRO so far. 🙂

    I’m afraid that there is not setting for displaying past events when no upcoming events are posted to the calendar.

    I think the only way to accomplish this (without custom development) would be to use the [tribe_events] shortcode.

    So, for example, you could show past events by setting a date filter on the shortcode, you can show past events from August in Photo View:

    [tribe_events view=photo date="2016-08"]

    It might even be possible for you to customize the Photo View Template so that if there are upcoming events, show the normal view, but if there are no upcoming events, show the shortcode. I believe the tribe_is_upcoming function would be a good check for that.

    The trouble, I know, is that this is not dynamic and would require your manual input which I’m sure is not what you’re looking for. That said, It’s possible you could achieve a more dynamic approach to this with custom development, but that is unfortunately something we are unable to support here in the forums.

    Sorry I don’t have a concrete solution for you, but will this help you get started? Please let me know!

    Cheers,
    Geoff

    #1201735
    Stuart
    Participant

    Hi Geoff,

    Can you help out a bit more with this please. Hunter said this help would be available if a Pro license was purchased: https://theeventscalendar.com/support/forums/topic/show-last-events/#post-1198081

    Many thanks.

    #1201808
    Geoff
    Member

    Hi Stuart,

    Sorry for the miscommunication here. While I think Hunter’s reply was well-intentioned, I can see how it could be misconstrued.

    We unfortunately do not provide support for custom development with a support license. Again, I think Hunter tried to articulate this when he said:

    Please note customization and conflict requests extend beyond what we’re able to cover

    …but, again, I can see how that could be misconstrued.

    I am happy to open a ticket for our developers to look at this at their leisure and then update this thread with anything they recommend. To be clear, though, I cannot guarantee that we will be able to build a customization for this.

    I am sorry again for the miscommunication here. If you would prefer to not wait for the chance that our developers will look at this and you would like a refund for your order instead, please let me know and I would be happy to. We offer full refunds within 30 days of purchase, and you are still good up through December 26, so please let me know and I would be happy to accommodate you either way.

    Thanks,
    Geoff

    #1201994
    Stuart
    Participant

    Thanks Geoff,

    I’d appreciate it if the devs could add suggestions please.

    Hunter said

    “It might even be possible for you to customize the Photo View Template so that if there are upcoming events, show the normal view, but if there are no upcoming events, show the shortcode. I believe the tribe_is_upcoming function would be a good check for that.”

    If I could get some guidance on what template or code I need to add that would be great. I appreciate the offer of a refund, but I will cross my fingers and hope that someone on your team can post a solution that would (I’m sure) help a lot of others too!

    #1202370
    Geoff
    Member

    You bet, thanks Stuart! I’ll make a ticket for the devs to check it out and will be sure to update this thread if and when some feedback is provided.

    The tribe_is_upcoming function is more or less a simple check to see if the current query is set to include future, upcoming events. In other words, it produces a true or false result, but I am not certain it would be entirely useful for this use case — for example, it does not appear to be useable as a filter for changing the query itself to include past events.

    What you might have more success with is the tribe_get_events function. It allows you to create your own custom query of events based on a number of variables. And, better yet, we have a guide on how to use it:

    https://theeventscalendar.com/knowledgebase/using-tribe_get_events/

    The issue here is that it does not build the layout for you. In other words, it simply outputs events based on your query instead of building the full Photo View for you.

    Another possibility might be to check for the Photo View and change the query to show both past and upcoming events in the same query. This is not tested and not a perfect example, but something like:

    if ( tribe_is_photo() ) {
    $events = tribe_get_events( array(
    // Set this to something really early to ensure past events display
    'start_date' => '2014-10-01 00:01',
    ) );
    }

    Again, a poor example, but hopefully it gets the ball rolling on some ideas. 🙂

    Cheers!
    Geoff

    #1203354
    Stuart
    Participant

    Thanks Geoff,

    I just need to work out which template/parts I need to add this to. Definitely helpful!

    #1204115
    Geoff
    Member

    Heck yeah, happy to be of service!

    I’ll go ahead and close this thread but please feel free to open a new one if any other questions pop up and we’d be happy to help.

    Cheers!
    Geoff

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Show Past Events if There are no Upcoming Ones’ is closed to new replies.