21st Aug '25
/
0 comments

Querying Posts by Date Field to Exclude Past Events with ACPT Plugin

In the Bricks’ Facebook group, a user asked:

Meta query? What am I missing?

Hi all, really need a little guidance on this one. I have a CPT called tradeshows, set up with ACPT. I have a loop showing them, but I would like to have the ones that the “End Date” has passed the current date to drop off and not be a part of the loop. I have tried so many combinations my head is spinning. Nothing is working. The field for the “end date” is {acpt_tradeshows_trade-show_end-date} I have tried Numeric instead of date for type, nothing is working. Please ask if theres anyhting I’m not sharing that might be helpful. Thank you!

The key to remember is that with ACPT, the date field is not stored as a Y-m-d string or a timestamp and hence can’t be used for direct comparisons in WP meta queries per my understanding.

While it is possible to use a custom function to convert the string to a timestamp or Y-m-d date and use it in Bricks query loop settings, the simpler approach is to change the date format in the advanced field settings to yyyy-mm-dd (it is the same as Y-m-d).

Next, edit all the posts and save them to update the date format.

Finally, configure your query loop in the Bricks editor like this:

{current_wp_date:Y-m-d}

This will ensure that past events are not shown.

Before:

After:

Get access to all 633 Bricks code tutorials with BricksLabs Pro

Leave the first comment

 

Related Tutorials..

Pro
Conditionally Outputting Query Loop Item Based on Post Meta in Bricks

Conditionally Outputting Query Loop Item Based on Post Meta in Bricks

Rendering query-loop enabled posts depending on the value of each post's custom field value is tricky because by default, the custom field plugins' functions or…
Categories:
Pro
6 Random Featured Posts in Alphabetical Order in Bricks

6 Random Featured Posts in Alphabetical Order in Bricks

How to output x number of random posts with a specific meta value set, in Alphabetical order.
Categories:
Pro
Posts Grouped by Authors in Bricks

Posts Grouped by Authors in Bricks

This Pro tutorial for Bricks users provides the steps to loop through users and inside that, through posts whilst setting the inner query's author parameter…
How to display a Query Loop in 3 columns in Bricks

How to display a Query Loop in 3 columns in Bricks

This tutorial provides the builder settings and CSS codes that can be pasted in order to create a 3-columns query loop container inside Bricks Builder.
Categories:
Pro
Post Data for the Current User in Bricks with Meta Box

Post Data for the Current User in Bricks with Meta Box

How to configure a query loop to output the post data of the SalesRep CPT associated with the current user.
Categories:
Pro
CPT Posts Grouped by Custom Taxonomy Terms in Bricks

CPT Posts Grouped by Custom Taxonomy Terms in Bricks

The steps to set up a Service Category terms loop with an inner Service posts loop in Bricks without writing code.
Categories: