Home Forums General Issues Bootstrap Modal


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.

                                *  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:
                                $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">
                                                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
                                        <?php endforeach; ?>
                                    <?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
                                <?php endif; ?>
Viewing 1 post (of 1 total)

The topic ‘Bootstrap Modal’ is closed to new replies.