Modules / Query loops & dynamic data

Query loop: date limit

Limit a query loop to recent posts, upcoming events, this week or month, or a date range, with fields next to the Query editor. It works on the published or modified date, or on a date stored in a custom field. You do not need to write a date query.

#13 of 39 modules by votes

  • On by default
  • Needs Bricks 2.4 or newer
  • Tested with Bricks 2.4.3
Recording: someone enters 30 in Only N on a loop of six journal posts, with Days and Back from now below it, and the loop keeps the three from the past month.Recorded in Bricks 2.4.3

How to use it

  1. Select a Container, Block or Div and turn on its query loop.

  2. Under the Query control, set the window:

    • Only N (Kiln), with a Unit (hours, days, weeks or months; days by default). Enter 30 to keep dates from 30 days ago up to today.
    • Count: Back from now (the last N) (the default) or Ahead from now (the next N), for upcoming events. Back from now ends today, or now for hours, so dates in the future stay out. Ahead with 30 days keeps dates from today to 30 days ahead.
    • Or this period: This week, This month or This year. The week starts on the day set under Settings > General > Week Starts On.
    • Only after date and Only before date: a date such as 2026-01-31, a phrase such as today or +30 days, or dynamic data such as {post_date}.
  3. Pick the Date column: Published, Modified, or A custom field. Left empty, it is Published.

  4. For a custom field, write its Custom field key (such as event_date) and choose how it is Stored as. Left empty, it is ACF date (20261231).

    • ACF date (20261231): ACF's Date Picker field.
    • Date (2026-12-31): Meta Box's default, and most plugins.
    • Date and time (2026-12-31 18:30:00): ACF's Date Time Picker.
    • Unix timestamp (site time): most plugins that save a date as a timestamp store the site's clock time this way. If dates come out shifted by your time difference from UTC, choose Unix timestamp (UTC).

    If the format doesn't match the field (an ACF date read as a date, for example), the loop comes back empty.

Leave a field empty to skip it. Set Only after date and Only before date together to get a range. Both dates are inclusive.

Where it appears in Bricks

Container, Block, Div, Content tab, directly under the Query control. The fields show only while the element has a query loop.

How it works with your Query editor

For "from today on" with an ACF date field, Bricks' own meta query already works: compare the field with {current_wp_date:Ymd}. Kiln adds windows (the last or next N), periods, and the published or modified date.

Kiln adds your fields as one more date condition (or, for a custom field, one more meta condition). Conditions you already set in the Query editor stay in place, and a post has to pass both.

A typed date replaces its own end of the window: Only after date with This month runs from that date to the end of the month. A period replaces Only N (Kiln).

Limits

  • Hours keep the time of day and count real hours across a clock change; days, weeks and months cover whole days, and a date you type covers its whole day. A custom field that stores only a date (no time) is compared by day even with hours.
  • Dates are read in your site's timezone (Settings > General). Counts start from now in that timezone.
  • Months follow the calendar: one month back from 31 March is 28 February.
  • Published dates in the future belong to scheduled posts. A loop shows them only if its query includes the Scheduled status; for events, a date in a custom field avoids that.
  • A date Kiln cannot read, or dynamic data that renders empty, turns that field off. A window that ends before it starts (an Only before date in the past with Ahead from now) is ignored, and the loop keeps all its posts.
  • Only N (Kiln) set to 0, or left empty, is off.

Settings

None. Turn the module on in Bricks > Kiln (it is on by default).

Requirements

Bricks 2.4 or newer.