• Resolved ayottepl

    (@ayottepl)


    Hello!

    I have a query on my development website that loop through a custom post type, to load a lot of employees into my page.

    Each employee has details, bio, and more i wanna show in a modal.

    My problem is that i can’t make your modal work into that loop ?? Looks like the modal is not generating basic stuff like aria-labelled. The modals exists, the triggers exists, but some specific class and id are not generated and i assume, that is because it’s inside a loop.

    If i add one single modal at the beginning of the page it’s working.

    My question is : do you know a way i can achieve that with you plugin ? Thanks for your help, i use it a on few sites already and i like how easy it is to use ??

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author merbmerb

    (@merbmerb)

    Hi

    Unfortunately, the plugin was only designed to be used via the editor and not designed to be generated dynamically which is what I believe you are trying to do.

    I do have a widget version of the modal which can be used with a shortcode, which is prob what you need. This has not been updated for a while (not even sure it still works) but you are more than welcome to take a look https://github.com/merbird/bod-widgets

    Thread Starter ayottepl

    (@ayottepl)

    Hello!

    Thanks for the reply! I use it in the editor and not as a shortcode ?? Sorry if i’ve not explain it correctly.

    It’s within the editor, within a loop. So i have 1 “template” in the editor and in another page i load that template within a loop to query all post in a certain post type.

    I shared you some screenshot.

    Thanks!!

    Plugin Author merbmerb

    (@merbmerb)

    Not sure but my guess is that your loop is run after the modal loop. The modal JavaScript is run as soon as the page is ready, if your page is created dynamically then the chances are it’s run before your loop. I will look at adding the ability to programmatically trigger the modal load, so it can be run at a later time.

    Plugin Author merbmerb

    (@merbmerb)

    Sorry I did not get your screenshots so I am not 100% sure what you are doing. You say you are using a template, are you talking about a Page Template, a Block Template or something else. Also you say you are then using that template to use generate content in another page. Are you coding this, using a plugin, a block…

    Have you tried using a Query Loop Block. These are relatively new but should allow you to do what you need. You would be able to use it to loop through your custom post type and incorporate a modal to display info for each employee.

    Thread Starter ayottepl

    (@ayottepl)

    Good morning! I’m sorry for the delay, i’ve been away for holidays ??

    Everything is inside a loop. I use JetEngine to create a listing template. Into that template, i dynamically load a team member photo/name/etc. Those infos are related to a CPT.

    I also add a modal block into it to preview the full content.

    On another page i load the listing so i can see all the employees. At that point, each employee has a photo, name, etc. Each employee also has a modal block associated to it. But, as that modal block probably load before, like you said, it is not functional.

    I don’t know why the screenshot doesn’t work.. here’s the page where i have all the employees : https://construction-longer.goaxi.al/equipe/
    When you click on the red button it works as i display your modal block with a bit of javascript to emulate like if it is working ??

    I totally understand it’s not easy to figure everything out without seeing the backend haha! I hope my explanation is a bit better this time. I haven’t try it in a basic query loop within a page, have you ? Is that working ?

    Plugin Author merbmerb

    (@merbmerb)

    Hi

    Took a quick look and it’s like I said, the employee data is being populated after the page load, and so after the modal js runs. I will add the ability to manually trigger the modal js.

    Plugin Author merbmerb

    (@merbmerb)

    OK, I just put out a release that should fix your issues. I did a couple of things. The first is I don’t load the modals until the document is ready, this may fix your problem. If that does not work then you can call the following js to manually load the modal data:

    bodModal.initModal();

    Thread Starter ayottepl

    (@ayottepl)

    Good morning!

    Thanks for all the efforts you put through!! ?? I’ve tested your last release this morning.

    Looks like it’s working! Well, the part i initialize manually the plugin ?? Because my listing load after everything is loaded so, of course it can’t work the easy way ^^

    Thanks for your help with that!! I wish you a great day ??

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Query Loop modals’ is closed to new replies.