Skip to main content
All CollectionsTutorials
How to Display Posts That Have a Date Field Greater than "1 week ago" From Today
How to Display Posts That Have a Date Field Greater than "1 week ago" From Today

In this tutorial, light has been shed on how to filter posts in Dynamic Posts based on their date field value.

Updated over 4 months ago

In this tutorial, we are going to use the ACF Date Picker in the Dynamic Posts query filter.

In order to show posts written in the last 1 week from today(or they have ACF date picker selected for the last one week from today), you can use the Date Query filter as below.

You can also use Metakey Query Filter to achieve the same result. However, you will need to compare the Metakey with the value (today's date - 7 days in this case).

In our Dynamic shortcode field, we will use the below shortcodes:

{date:"-1 week" @ format="Ymd"}

Interestingly, if we change the operator to "less than", it will hide all the posts which have a date field value of the last 1 week. Which is not possible with a normal date filter.

Did this answer your question?