Support » Plugin: Pods - Custom Content Types and Fields » Pods with Modern Tribe Event Calendar: How display only events from current day

  • Resolved michaelrayburke

    (@michaelrayburke)


    Hey there fine PODs enthusiasts!

    Doing some digging around, it looks like you all have a lot of experience with The Event Calendar by Modern Tribe.

    I love both plugins. However, I have no idea how to tackle this issue…

    I created a POD template for tribe_events so I can display the information just how I want it along with some new taxonomies, easy-peezy.

    However, I ran into one issue… I want this template to display events just from the CURRENT date.

    I figured this can be done using the “where=” somehow… but I am just lost on how to do it.

    Any suggestions?

Viewing 15 replies - 1 through 15 (of 26 total)
  • Plugin Author Scott Kingsley Clark

    (@sc0ttkclark)

    How are you using the template? Are you using a shortcode on a page or outputting it with your own PHP $pod->template( 'my-template' )?

    michaelrayburke

    (@michaelrayburke)

    Sorry for the late reply!

    This particular website, I was using shortcodes. I would prefer to use this method if it can be done.

    Plugin Author Scott Kingsley Clark

    (@sc0ttkclark)

    Can you provide the shortcode you want to add a WHERE to?

    Plugin Author Jim True

    (@jimtrue)

    You want to take a look at the Using Date Based Searches from our Docs:
    https://docs.pods.io/searching-filtering-sorting/complicated-where-sort-and-filters/using-date-based-searches/

    Specifically the BETWEEN statement.

    Also the field for Event Start Date is _event_start_date in tribe_events, it’s hidden, so you’ll have to reference it with _event_start_date.meta_value in the shortcode.

    I didn’t like doing upcoming/past math, so I used The Event Calendar Shortcode.

    Plugin Author Scott Kingsley Clark

    (@sc0ttkclark)

    We (I work for Modern Tribe AND I’m also the lead dev for Pods) also have a docs page for the Events Calendar PRO Shortcodes available: https://support.theeventscalendar.com/273956-Events-Calendar-PRO-Widget-Shortcodes-Overview

    Plugin Author Jim True

    (@jimtrue)

    Don’t most of those require the TEC Pro Version to use?

    @michaelrayburke is also using one of our templates being called in a Pods Shortcode. Hence the BETWEEN and Date Math 😉

    Plugin Author Scott Kingsley Clark

    (@sc0ttkclark)

    Right, those are only for Events Calendar PRO (in case OP was a PRO customer).

    @sc0ttkclark here is the shortcode:
    [pods name=”tribe_events” template=”bp slider”]

    @jimtrue I want to show the current date at all times… is math involved with that? The problem with the Tribe shortcodes is that the out of the list and day events layout isn’t what I need. I know I can edit it through that plugin too, but I like the pods template I designed.

    Hopefully there’s a way to do this. 🙂

    Plugin Author Jim True

    (@jimtrue)

    Anytime you’re dealing with dates in custom meta fields, you are dealing with date math.

    where="CAST(_event_start_date.meta_value as DATE) = CURDATE()"

    So, if I insert this where, whenever I visit the page, it will show the events of the current date?

    Plugin Author Jim True

    (@jimtrue)

    Your answer to that would be too try it and see if it works for you. CURDATE() is the MySQL command for the current date.

    So, I tried that “where” in the shortcode… still no good. 🙁

    Here is my shortcode below.

    (Note, in my above comment, I posted the wrong template name.)

    [pods name=”tribe_events” where=”CAST(_event_start_date.meta_value as DATE) = CURDATE()” template=”program screen”]

    Any other ideas?

    Plugin Author Jim True

    (@jimtrue)

    Are you getting a SQL error? Is it displaying all information? What does ‘still no good’ mean? Sorry but you need to be exact on stuff like this.

    My suggestion is that CURDATE() is probably returning the DATE and the Time, so add CAST(CURDATE() as DATE) or:

    
    [pods name=”tribe_events” where=”CAST(_event_start_date.meta_value as DATE) = CAST(CURDATE() as DATE)” template=”program screen”]
    

    Sorry not to be specific.

    At first I got a SQL error, but I think I just entered something incorrectly. Now, I just see a blank spot – so it’s like it is trying to work.

    Now, I just tried the new example, and still, just a blank spot. No error, but no events are listed.

    Any other suggestions? Is there more information I can give you to help point us in the right direction?

    Sorry if I am not getting it or if what I want to do is complicated. Please don’t give up on me, I will be specific and give you the information you need. I really appreciate the help with this.

Viewing 15 replies - 1 through 15 (of 26 total)
  • You must be logged in to reply to this topic.