I am trying to create a page in my WordPress theme where the posts are displayed in CSS grid. When a grid square is clicked the featured image for the clicked post will appear in a modal window. I have managed to get the modal window working but it displays the featured image of the most recent post regardless which post is selected. I tried assigning a unique id to image div using get_post_id
but I can’t work out how to pass this to the JavaScript’s getElementById
? (if that is in fact the correct way to solve this?)
I’m a newbie coder and not so familiar with JavaScript – any help would be hugely appreciated.
Here’s my code:
- Hiện tại chúng tôi có hơn 25 nghìn bài văn mẫu các thể loại.
- Kho tài liệu, đề thi học sinh giỏi các lớp vô cùng phong phú.
- Mỗi ngày cập nhật hơn 100 đề thi chất lượng từ các website bán tài liệu lớn.
Tải đề thi VIP với giá siêu rẻ tại Vip.Dethihsg247.Com