Using tribe's template tags with tribe_get_events

Home Forums Calendar Products Events Calendar PRO Using tribe's template tags with tribe_get_events

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #111171
    pickleshy
    Participant

    Hi,

    We’re trying to create a custom tag template so that the events occur in ascending order and also so they have the same format as the events list (basically what was suggested on https://theeventscalendar.com/support/forums/topic/event-tags-display-and-implementation-issue). We were successful in getting the order and format we want, but when we tried to add month headers back into the list, by calling tribe_events_list_the_date_headers, errors are printed on the page saying that $prev_event_month is undefined. Also, the month prints out for every event, even when one event is in the same month as the last. This happens with the simplest of queries as seen at https://gist.github.com/CRSnyder/ec43d2fa72c2aabf92df.

    We assume that the error occurs because this template tag uses $wp_query and tribe_get_events doesn’t use the default query. We’re just curious whether there is an expectation that any template tag would work in this scenario or if some can only be called from the main query.

    #111859
    Barry
    Member

    Hi – great questions!

    Just as with WordPress, some template tags do indeed assume they will be used in relation to the global $wp_query object – and that is the case here.

    So, in a situation like this one, you would either need to devise a workaround with regards to the $wp_query global (proceed with caution if so!) or else build an alternative template tag that functions in the circumstances you are trying to use it.

    I hope that helps 🙂

    #120576
    Barry
    Member

    It’s been a while so I’ll go ahead and close this thread – if we can help with anything else though please don’t hesitate to create new threads as needed. Thanks!

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Using tribe's template tags with tribe_get_events’ is closed to new replies.