Component with modal in Query Template

As I was trying to find an answer to “How to make dynamic content in popup modal” by using a component I ran into something that seemed strange and might be a bug.

I am creating a component inside a query template
In this component, I have 2 settings:

1 named Title set as Text / advanced
1 modal-id set as ID / auto-generate

In my component I have :

-a Heading with content Title which serves as a link to open the modal with modal-id as Block-ID of the modal

  • a modal with a modal-id as an id and a heading inside with Title as content which also serves as a link to close the modal with modal-id as Block-ID

This component is placed in the Query template with dynamic value for Title of Wordpress/Post Title.

When rendering the page, the Titles displayed are the correct title of the Queried posts but when I click on the title and open the modal, the title appearing in the modal is always the same and seems to be the first post in the query while I would expect to have the same title as the one displayed outside the modal.

I am not sure if I am only triggering the same modal or if the heading block is not displaying the right info, I tried to display the auto-generated ID but it doesn’t seem to be available.

The preview within the editor shows in the modal {title} instead of the queried Post Title.

I tried another way with only ID as a property and using dynamic fields in both headings as Wordpress/ Post Title and this presents the same issue in the rendered pages but the correct content within the editor preview.

:thinking:

Thank in advance for your input,

J

Hi @JuGa,

I will try to show you a working example at some point before next week, I am just very busy at the moment.

There is a trick to doing it that requires syncing the content in the modal with the other query.

2 Likes

thanks @StrangeTech I’ve seen your post and was trying an alternative solution using Component.
I still think that the discrepancy between the builder preview and the rendered page shows a possible issue…

best with your projects!

J

1 Like