Timeline for display WP image posts in Bootstrap 4 modal
Current License: CC BY-SA 4.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 11, 2019 at 23:26 | comment | added | Sally CJ | You're welcome, @maik. And although you already got it working, I revised the answer and hopefully it's more clear now - and helpful to other users as well. :) Cheers and all the best! | |
May 11, 2019 at 23:25 | history | edited | Sally CJ | CC BY-SA 4.0 |
A better answer.. :)
|
May 11, 2019 at 22:03 | vote | accept | inputforcolor | ||
May 11, 2019 at 21:06 | comment | added | inputforcolor | and not supposed to use comment to say thanks but I really am very grateful for your input : ) | |
May 11, 2019 at 21:05 | comment | added | Sally CJ | Let us continue this discussion in chat. | |
May 11, 2019 at 21:05 | comment | added | inputforcolor | I just updated the page online _ with the modal code inside the while loop _ Now it's only showing the first image_ instead of the last image I wish I could use your suggestion Sally _ Problem is I can't really follow it _ sorry (by that I mean I don't know where to put the jquery = in the footer.php?) Also in option 2 _ I don't understand the reference to image in this code _ '<img src="' + image + '" alt="" />' You've taken so much time to help_ it's my incompetence that isn't helping _ which is why I'm sorry | |
May 11, 2019 at 21:00 | comment | added | Sally CJ | "the same modal to display whichever image is clicked on" - yes, that is exactly what my answer is all about. | |
May 11, 2019 at 20:59 | comment | added | Sally CJ | No, I'm not. I'm insisting that you try the suggestions in my answer... It worked well for me. Trust me! :D | |
May 11, 2019 at 20:55 | comment | added | inputforcolor | aha! _ I only want to use one modal Sally _ but for it the same modal to display whichever image is clicked on _ I will add the wp_reset_postdata() as you stated but just to be clear _ Are you advising put all of the code for the modal inside the while loop? (Thanks for checking the link) | |
May 11, 2019 at 20:50 | comment | added | Sally CJ |
Yes, I understand it - and you could try wp_reset_postdata(); (which you should've called after the endwhile , anyway..) but it won't work for what you're trying to do. But you see, you'd only be using one modal; otherwise, you could move the modal into the while loop and the post ID would work. But really, the modal is a JavaScript thing and if you want to be able to display varying content, please consider trying what I suggested in the answer. And yes, the first thing I did after reading this question was visiting the link you provided.
|
|
May 11, 2019 at 20:43 | comment | added | inputforcolor | thanks for this Sally _ I'm a bit confused tbh _ Did you get a chance to visit the page I linked to? Everything is working except that the wrong post / image is being displayed in the modal _ Whatever post is last added to the page is the one being displayed _ So i think this is more a question of using the inbuilt Wordpress post ID rather than relying on Bootstrap functionality to try and resolve the issue _ it's really how to use the Wordpress post ID is what I need _ but thanks again | |
May 11, 2019 at 20:30 | history | answered | Sally CJ | CC BY-SA 4.0 |