carstingaxion / additional-advanced-query-loops

WordPress plugin that introduces a Query Loop block variation that can create advanced queries.
1 stars 0 forks source link

WIP contextual-query-loop branch #10

Open carstingaxion opened 4 months ago

carstingaxion commented 4 months ago

contextual-query-loop branch

image

carstingaxion commented 4 months ago
Outdated screencast 🎦 https://github.com/carstingaxion/additional-advanced-query-loops/assets/198883/0f077ac4-06ff-44e2-81c9-a92b02b3cff1
carstingaxion commented 4 months ago
Outdated screenshot 🖼️

![image](https://github.com/carstingaxion/additional-advanced-query-loops/assets/198883/b3072d58-56fd-48b1-9263-5f94a11c1dbc)

carstingaxion commented 4 months ago

Needed a new block to demo another block

Name of the current post type using the Block Bindings API

https://gist.github.com/carstingaxion/f98c213aad40d6413fe50eac1cc92228

carstingaxion commented 4 months ago
Outdated screenshot 🖼️

![image](https://github.com/carstingaxion/additional-advanced-query-loops/assets/198883/1cd63194-a828-483b-925d-159608b1c601)

carstingaxion commented 4 months ago

Hello @ryanwelcher,

feel free to have a look, what was possible in a short time, because of your solid & exciting fundament. Thank you very much for equipping me (and others) with the right tools & code to solve long-standing issues!

It is amazing 🎈 🎉 🥳 !

carstingaxion commented 4 months ago
Outdated screencast 🎦

https://github.com/carstingaxion/additional-advanced-query-loops/assets/198883/b7f25755-6c58-4228-85b0-eb8f7f183540

carstingaxion commented 4 months ago

https://github.com/carstingaxion/additional-advanced-query-loops/assets/198883/8b9f071a-bc03-4063-8723-f59c7d153629

carstingaxion commented 4 months ago

https://github.com/carstingaxion/additional-advanced-query-loops/assets/198883/623a17f9-f034-4527-aab3-7d4dce7e7995

Contextual queries with

carstingaxion commented 4 months ago

Screenshot of a demo to show & test different uses of a new contextual-query-block.

The demonstrated queries are:

  1. IN same author
  2. IN same author & other post type
  3. NOT IN same author
  4. Some IN same tags
  5. All IN same tags
  6. NOT IN same category
  7. IN same category & NOT IN same tags
  8. EXACT same date
  9. BEFORE same year
  10. AFTER same month
  11. EXACT same day last month
  12. EXACT same day last year

image

carstingaxion commented 4 months ago

image

Finished my ideas around queries by contextual date. Inspired by

mrgoff93 commented 4 months ago

This looks great, thanks for working on it!

It's not yet quite what I am hoping for. In my case, I would like to specify a date - either contextually (for example, using the date the post was published), or by choosing it directly (via a calendar selection).

So if the date was 2023-05-20, then the query would return any posts published on YYYY-05-20 across all the years (which in my case could back over 20 years).

Just to offer a little more context, my site is all about natural history, and I have been posting photojournals of what I observe on a given day going back to the early 2000s. With the functionality I'm hoping for, it would be easier to create a daily or weekly almanac of sorts for my area.

Thank you!

carstingaxion commented 4 months ago

This looks great, thanks for working on it!

Thank you @mrgoff93

It's not yet quite what I am hoping for. In my case, I would like to specify a date - either contextually (for example, using the date the post was published), or by choosing it directly (via a calendar selection).

Ok, this is already in place & should work.

So if the date was 2023-05-20, then the query would return any posts published on YYYY-05-20 across all the years (which in my case could back over 20 years).

You are right, this is not possible right now. But what I did so far is close to that and it might be not of a big deal to extend the existing logic. Currently you can query for what happened on day x 13 years ago, but not on day x over the last 13 years.

Just to offer a little more context, my site is all about natural history, and I have been posting photojournals of what I observe on a given day going back to the early 2000s. With the functionality I'm hoping for, it would be easier to create a daily or weekly almanac of sorts for my area.

This is really cool, you are describing your use-case like this. I had some similar thoughts, imaginating someone doing wild-life photography during all seasons of the year and for many years. That feels super-close to what you describe.

carstingaxion commented 4 months ago

image

it might be not of a big deal to extend the existing logic

@mrgoff93 No, it wasn't. Exactly 4 lines of code added, to make this work.

Now, it seems to be the perfect sibling to @coffee2code|s - Years Ago Today – Dashboard widget.