[Resolved] Creating an “Upcoming Events” page with Query Loops: Date handling

Home Forums Support [Resolved] Creating an “Upcoming Events” page with Query Loops: Date handling

Home Forums Support Creating an “Upcoming Events” page with Query Loops: Date handling

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #2426477
    John

    Hello team,

    Using GP Pro and GB Pro. Using Metabox, I have created an “Events” custom post type, and have created a bunch of custom fields for it. My intention is that outside partners will use this interface to publish the events themselves.

    Among these custom fields, I have created a “Start Date” field, “Start Time”, “End Date”, and “End Time”. I’m using the Metabox builder and the date fields use the “Date Picker” field type (it uses jQuery).

    Anyhow: now I want to create an Events page using GB and the Query Loop. I am facing 2 issues so far:
    – I don’t know how to sort the events by the “Start Date” custom field
    – I want to show only the upcoming events; as soon as an event has ended (“End Date” custom field), I would like to remove it from the list entirely.

    Is that at all possible with GB?

    Thank you for your help

    PS: I found this other thread and tried to copy the PHP snippet, replaced the class name and custom field name accordingly, but it didn’t work (or I’m missing how it’s supposed to work, as I don’t see any other option to ‘Order By’ in the query)

    #2426496
    John

    Update: tweaking the code from the thread I linked to above, I was able to order the posts by the date custom field. I was only able to make it work by changing the date format to yy-mm-dd and I would much prefer to show a more human friendly format. Does the PHP function handle other formats?

    Now my main concern is to further filter the posts in the loop to REMOVE the past events, i.e. events for which the ‘End Date’ custom field is in the past. Is it possible to achieve with GB Pro?

    Thank you

    #2426510
    Fernando
    Customer Support

    Hi John,

    Having Post meta Parameters is currently not possible in GB Pro. It’s something that our team is planning on adding in the future. Hopefully, with this feature, you’ll be able to order by your post-meta date, and add a parameter to exclude posts from a certain post-meta date.

    Ordering the date by meta should work regardless of the format. For further assistance, can you open a topic here instead?: https://generateblocks.com/support/

    #2426781
    John

    Ok, thank you!

    #2426787
    Fernando
    Customer Support

    You’re welcome John!

    #2443528
    Heinrich

    hi fernando,

    i have the same setting (metabox) and 100% the same requirement. will this show up in the next release?

    #2443741
    Fernando
    Customer Support

    Hi Heinrich,

    Ordering posts through a custom meta is something being planned for a future update. We don’t have a timetable yet, and we’re not sure yet if it will be in the next update, but it’s going to be a GB Pro feature.

    For now, you’ll need a custom code to do so. You can reach out to us here for further assistance: https://generateblocks.com/support/

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.