Support

Account

Home Forums ACF PRO Inegrate while loop repeater

Helping

Inegrate while loop repeater

  • For PHP questions like this. Please let me know if can help or recommend your favorite form since I’m trying to learn PHP and ACF.

    Here’s the code for this WordPress page

    Below that is the ACF callouts that works fine on it’s own file.

    How do I integrate the callouts snippet below the slideshow?

    get_header(); ?>
    
    <?php if(!wp_is_mobile()) { ?>
    	<div id="primary-one" class="site-content">
    		<div id="content" role="main">
    
    			<?php while ( have_posts() ) : the_post(); ?>
    				<?php if ( has_post_thumbnail() ) : ?>
    					<div class="entry-page-image">
    						<?php the_post_thumbnail(); ?>
    					</div><!-- .entry-page-image -->
    				<?php endif; ?>
                    
    				<?php echo isset($_GET['jsn']) ? do_shortcode('[empc_meetings_beta]') : do_shortcode("[empc_meetings]"); ?>
    				
    				<?php 
    					if(wp_is_mobile()==FALSE) {
    						echo do_shortcode("[pb_slideshow group=2]"); 
    					}
    				?>
                
    			<?php endwhile; // end of the loop. ?>
    
    		</div><!-- #content -->
    	</div><!-- #primary -->
    <?php } else {?>
    	<div id="primary-one-mobile" class="site-content">
    		<div id="content" role="main">
    
    			<?php while ( have_posts() ) : the_post(); ?>
    				<?php if ( has_post_thumbnail() ) : ?>
    					<div class="entry-page-image">
    						<?php the_post_thumbnail(); ?>
    					</div><!-- .entry-page-image -->
    				<?php endif; ?>
                    
    				<?php echo isset($_GET['jsn']) ? do_shortcode('[empc_meetings_beta]') : do_shortcode("[empc_meetings]"); ?>
    				
    				<?php 
    					if(wp_is_mobile()==FALSE) {
    						echo do_shortcode("[pb_slideshow group=2]"); 
    					}
    				?>
                
    			<?php endwhile; // end of the loop. ?>
    
    		</div><!-- #content -->
    	</div><!-- #primary -->
    
    <?php }?>
    <?php get_footer(); ?>
    <?php				
    if (get_field('callouts')) : ?>
    
    <? while (the_repeater_field('callouts')) : ?>
    	
    <div class="callout">
    	
    <a href="<?=get_sub_field('callout_url')?>">
    	
    <h2><?=get_sub_field('callout_title')?></h2>
    								
    <? $photo = get_sub_field('callout_icon'); ?>
    	
    <img src="<?=$photo['url']?>" alt="<?=$photo['alt']?>" class="img-callout" />
    								
    <span><?=get_sub_field('callout_text')?></span>
    </a>
    </div>
    
    <? endwhile; ?>
    
    <?php endif; ?>
  • Hi @jknetdesign

    You can have the code looking like so:

    get_header(); ?>
    
    <?php if(!wp_is_mobile()) { ?>
    	<div id="primary-one" class="site-content">
    		<div id="content" role="main">
    
    			<?php while ( have_posts() ) : the_post(); ?>
    				<?php if ( has_post_thumbnail() ) : ?>
    					<div class="entry-page-image">
    						<?php the_post_thumbnail(); ?>
    					</div><!-- .entry-page-image -->
    				<?php endif; ?>
                    
    				<?php echo isset($_GET['jsn']) ? do_shortcode('[empc_meetings_beta]') : do_shortcode("[empc_meetings]"); ?>
    				
    				<?php 
    					if(wp_is_mobile()==FALSE) {
    						echo do_shortcode("[pb_slideshow group=2]"); 
    					}
    				?>
    <?php				
    if (get_field('callouts')) : ?>
    
    <? while (the_repeater_field('callouts')) : ?>
    	
    <div class="callout">
    	
    <a href="<?=get_sub_field('callout_url')?>">
    	
    <h2><?=get_sub_field('callout_title')?></h2>
    								
    <? $photo = get_sub_field('callout_icon'); ?>
    	
    <img src="<?=$photo['url']?>" alt="<?=$photo['alt']?>" class="img-callout" />
    								
    <span><?=get_sub_field('callout_text')?></span>
    </a>
    </div>
    
    <? endwhile; ?>
    
    <?php endif; ?>
                
    			<?php endwhile; // end of the loop. ?>
    
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Inegrate while loop repeater’ is closed to new replies.