Filtering Popular Posts on Drupal: How to Filter by Time Frame with Views

| Drupal Development | 10 seen

In a previous tutorial, I showed how to use Views to filter popular posts on a Drupal site. Today, I will demonstrate how to filter popular posts within a specific time frame, such as a week or a month.

Note that this tutorial will only apply filters to the most viewed nodes based on their publishing date, not to all nodes within a certain time frame.

If you haven't already set up a popular blog post View, please refer to the link above and follow the steps to create your View.

To begin, open your popular blog post View and add a new filter under the "Filter" section. Select "Content: Post date" and choose "Operator: is between" in the filter settings.

In the "Min" field, enter the time frame you want Drupal to filter, for example, if you want to filter posts from the last 10 days, enter "-10 days" as the offset. In the "Max" field, enter the current time to ensure that future posts are not included in the filter.

If you have any questions or issues with this process, please leave a comment below and I will be happy to assist you.

Add new comment