I have a WP_Query that shows a list of posts. Pretty standard, however, within that I'm call multiple instances of functions like the_title(); for use in a popup modal that is supposed to display the post that was clicked on, but instead just shows the first one in the loop again.
<?php
$members = new WP_Query( 'post_type=member' );
if ( $members->have_posts() ) :
while ( $members->have_posts() ) : $members->the_post();
// get the src of the post thumbnail
$src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full', false, '' );
$thumbnailSrc = $src[0];
?>
<div class="col-sm-3 member">
<img src="<?php bloginfo('template_directory'); ?>/timthumb.php?src=<?php echo $thumbnailSrc; ?>&h=250&w=250&zc=1q=100" alt="" data-toggle="modal" data-target="#memberModal">
<h4><?php the_title(); ?></h4>
<p><?php the_field('member_title'); ?></p>
</div>
<div class="modal fade" id="memberModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<img src="<?php bloginfo('template_directory'); ?>/timthumb.php?src=<?php echo $thumbnailSrc; ?>&h=300&w=650&zc=1q=100" alt="" class="img-responsive">
<h2><?php the_title(); ?></h2>
<p><?php the_field('member_title'); ?></p>
<p class="lead"><?php the_field('member_introduction'); ?></p>
<?php the_field('member_description'); ?>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<?php endwhile; else:
echo '<p>Sorry, there are no posts to display</p>';
endif;
?>
In the example above, a div.member is created for each post. But then the div.modal only shows the first post.
In a way, I'm trying to create one of these (div.member + div.modal) for each post.
UPDATE:
Here is a visual representation. The loop spits out the four 'members' in the post_type with the data for each one.
But no matter which one I click on, the modal just fetches the data from the first post.