Hey John,
This is possible without any custom PHP coding or custom taxonomies.
WordPress has native support for querying posts by their publish dates using the date_query parameter in WP_Query. Because Cornerstone’s Custom Query Builder parses Twig, you can conditionally build a date_query that handles year and month parameters (even when they contain multiple selected checkbox values).
Here is how you can set it up:
1. The Custom JSON for Query Builder
Modify your Custom JSON in the Query Builder to use date_query. WordPress’s date_query natively accepts arrays of numbers for year and month, which is perfect for multiple checkboxes:
SAMPLE BELOW:
{
"post_type": "post",
"cat": {{ url.param({"key":"post-category"}) | json_encode }},
"s": "{{ url.param({"key":"search"}) }}"
{% set year_param = url.param({"key":"post-year"}) %}
{% set month_param = url.param({"key":"post-month"}) %}
{% if year_param or month_param %}
, "date_query": [
{
{% if year_param %} "year": {{ year_param | json_encode }} {% endif %}
{% if year_param and month_param %}, {% endif %}
{% if month_param %} "month": {{ month_param | json_encode }} {% endif %}
}
]
{% endif %}
}
2. How to Set Up the Checkbox List Options
For the filters to work, the values of the options in your Checkbox Lists must match what WordPress expects for dates:
For the Year Checkbox List:
The value of each checkbox option must be a 4-digit year (e.g., 2024, 2025, 2026).
For the Month Checkbox List:
The value of each checkbox option must be the numerical representation of the month (e.g., 1 for January, 2 for February … 12 for December).
How this works for site editors:
Site editors do not need to do anything extra. They simply publish the post normally.
WordPress automatically extracts the year and month from the native post.publish_date and performs the comparison under the hood against the selected checkbox values.
| # | Наименование новости | Тональность | Информативность | дата |
|---|---|---|---|---|
| 1 | Question about filtering default post categories with CS Forms | 0 | 0 | 22-06-2026 |
| 2 | Question about filtering default post categories with CS Forms | 0 | 0 | 21-06-2026 |
| 3 | Question about filtering default post categories with CS Forms | 0 | 0 | 22-06-2026 |
| 4 | Taxonomy Term redirect to filterable Post Type Archive | 0 | 0 | 22-06-2026 |
| 5 | CS Forms & Off Canvas | 0 | 0 | 22-06-2026 |
| 6 | Question about filtering default post categories with CS Forms | 0 | 0 | 21-06-2026 |
| 7 | Taxonomy Term redirect to filterable Post Type Archive | 0 | 0 | 22-06-2026 |
| 8 | Taxonomy Term redirect to filterable Post Type Archive | 0 | 0 | 22-06-2026 |
| 9 | Accessibility Question | 0 | 0 | 21-06-2026 |
| 10 | Need help setting up a looper of products that have an ACF Post Object selected | 0 | 0 | 22-06-2026 |