WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
9.99k stars 4.01k forks source link

Query Loop: Add filter by year #58401

Open richtabor opened 5 months ago

richtabor commented 5 months ago

I saw this cool blog and thought it'd be interesting to try the same in WordPress, but the Query Loop block does not provide a filter by date/year control.

Visual

CleanShot 2024-01-29 at 12 24 56

Control

CleanShot 2024-01-29 at 12 26 57

dhanson-wp commented 3 months ago

A filter by Month would be nice too. What if you wanted to display posts like a calendar, so all posts in March 2024, March 2023, etc. This blog has a custom archive that filters by month.

akasunil commented 1 week ago

Here is a design idea. Please let me know if you have any feedback.

The query filter options include a date option:

Screenshot at Jun 24 10-45-52

Field options for month and year-specific query filters:

Screenshot at Jun 24 10-51-43

Month dropdown field options:

Screenshot at Jun 24 10-58-51
dhanson-wp commented 1 week ago

@akasunil that design looks great!

richtabor commented 2 days ago

I wonder if filtering by month and year separately would be a bit clearer. It feels a bit convoluted to include them together as "All" months within a year, rather than picking a year, or picking a month and a year.

Can you share examples of queries that would work for date as a generic filter, for month and year?