I’ve a customized submit sort archive that has articles that decision some ACF content material on every submit. I’ve used WP_Query to tug these articles onto the archive web page, and there is a button in every article that when clicked will open a modal window with photographs I’ve positioned in an ACF repeater for the customized submit.
How do I name the modal window by that button with out calling the opposite modal home windows open?
Here is my code for the archive web page:
<?php if ($the_query->have_posts()) { ?>
<div id="post-list" class="columns property-grid">
<?php whereas( $the_query->have_posts() ) : $the_query->the_post(); ?>
<?php get_template_part( 'partials/content material' , 'property' ); ?>
<?php endwhile; // whereas has_post(); ?>
<?php the_posts_pagination(); ?>
</div>
<?php } else { ?>
<?php } wp_reset_postdata(); ?>
<?php } endif { ?>
and here is my code for the info per article loop:
<h2><?php the_title(); ?></h2>
<?php echo get_field('property_address');?>
<a href="#" class="button gallery-button">View Photographs</a>
Right here is my code for the modal gallery popup, if vital:
<div class="modal-gallery">
<span class="shut cursor" onclick="closeModal()">&occasions;</span>
<div class="modal-content">
<?php if(have_rows('property_gallery')) : ?>
<?php whereas(have_rows('property_gallery')) : the_row() ?>
<img class="prop-image" src="<?php echo get_sub_field('picture'); ?>" alt=""><br>
<!-- Subsequent/earlier controls -->
<a category="prev" onclick="plusSlides(-1)">❮</a>
<a category="subsequent" onclick="plusSlides(1)">❯</a>
<!-- Caption textual content -->
<div class="caption">
<p><?php echo get_sub_field('image_text'); ?></p>
</div>
<?php endwhile ?>
<?php endif; ?>
</div>
</div>
in my JS file I’ve a operate known as openModal, however I do not know the way to name the Modal window of a selected article. If I name by class it will not work since every button will share that class, and I am unable to specify an ID with out an ID already being set per article. The unfinished code is under:
operate openModal(){
$('.gallery-button').click on(operate(){
occasion.preventDefault();
console.log('gallery-button pressed');
});
}