Modal opens all post IDs

This is my modal code. The first code displays and image, job title and name of each post ID.

When the user clicks on the more info link it should open a button with more info about the post, but instead it opens all post modals. Is there any way I can get only the same post ID to open as a modal?

<div><?php echo wp_get_attachment_image($image_upload,$size = ‘full’);?><br/>
<span class=”name”><?php echo $title; ?></span><span class=”jobtitle”><?php echo $jobtitle; ?></span>
<a onclick=”return moreinfoModal(this);” id=”<?php echo get_the_ID();?>” data-toggle=”modal” data-target=”#moreinfo-modal-<?php echo get_the_ID();?>” href=”javascript:void(0);” class=”info”>more info</a>

<div id=”moreinfo-modal-<?php echo get_the_ID();?>” class=”moreinfo-modal” role=”dialog”>
<div class=”teammember_div”>
<a id=”close-moreinfo” onclick=’return closeMoreInfoModal();’ href=”javascript:void(0);”><img src=””></a>
<?php echo wp_get_attachment_image($image_upload,$size = ‘full’);?>
<p><?php echo $title ?></p>
<p><?php echo $about ?></p>
<span class=”jobtitle”><?php echo $jobtitle ?></span>

<span id=”moreinfo” style=”display: inherit;”></span>
<a id=”modal-join” class=”btn-cta” href=”/sign-up/”>Become a Member!</a>

<?php }?>

Read more here:: Modal opens all post IDs

Leave a Reply

Your email address will not be published. Required fields are marked *