Home › Forums › General Issues › Bootstrap Modal
Good day Devs,
I am creating a site using ACF Pro and I’m trying to use a Bootstrap modal to pull in info on a CPT (presenter). Any ideas on how to get this working would be greatly appreciated.
<?php
/*
* Loop through post objects (assuming this is a multi-select field) ( setup postdata )
* Using this method, you can use all the normal WP functions as the $post object is temporarily initialized within the loop
* Read more: http://codex.wordpress.org/Template_Tags/get_posts#Reset_after_Postlists_with_offset
*/
$post_objects = get_field('presenter');
$post_id = get_the_id();//make sure this getting the correct post id
if( $post_objects ): ?>
<div class="team-carousel">
<?php foreach( $post_objects as $post): // variable must be called $post (IMPORTANT) ?>
<?php setup_postdata($post); ?>
<div class="carousel-cell member text-center">
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail( 'presentation-thumbnail', array( 'class' => 'img-fluid mb-3' ) );
}
?>
<?php the_title(); ?>
<span><?php the_field('position'); ?></span>
<a class="btn btn-primary btn-block mt-3" data-toggle="modal" data-target="#presenter">
View More
</a>
</div>
<?php endforeach; ?>
</div>
<?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
<?php endif; ?>
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
🚀 ACF & ACF PRO 6.0.7 are now available.
— Advanced Custom Fields (@wp_acf) January 18, 2023
✨This release contains bug fixes and improvements while we continue to work on the next major release of ACF.https://t.co/wQgAOpwmUI
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.