Is it possible to make a query through the medias?

In the query settings I saw what it seems to be a possibility to make a query using the medias

But I have a problem when I try to add a “div” to the query template: I have a “no result” comment in place of the “divs”

Hi @Ombres-et-lumieres
Yes you can and here is how:
In your Query block set to Post.
In Posts, set Post type to Media
then go to Status and set Post Status to Inherit

Right now I don’t know a way to get the image URL using the Image block (@Louis do you think that could be a coming possibility?) but you can get:
the image name by using Post Title
the image date/time by Using Post Date/Post Time

For the rest (such as the image it self), I believe you would need some snippets.

Here a few resources to get started:

I believe you should be able with Cwicly to retrieve ACF fields that you would have added to the Media library as well.

As an artist like you, it always made sense to me to try to use the media library with taxonomies and relationships in order to make a nice artist website/database, started and gave up multiple times… Maybe Cwicly will bring us all of what is needed to do so.

Best of luck…


Sorry for this very long delay.

I tried what You said and I have a result for the query, but not the right result: the phots doesn’t print themselves

So, here 's what I did and what I have:

(1) The HTML:

Capture d’écran 2023-03-13 à 13.03.35

(2) And for the photo:

Capture d’écran 2023-03-13 à 13.18.34

(3) The query:

Capture d’écran 2023-03-13 à 13.18.11

(4) The result

I think that the problem comes from the point (2): in the library, it is a post and not a “featured image”, so this setting must be added to the choices

I will try with some code.

yeap, that is what I was saying,
the featured image won’t work, but the query returns results that you can display with cwicly block aka date or name but not the image itself for which you will need a snippet in the time being