Support

Account

Home Forums Add-ons Repeater Field Repeater field returns nothing from a Template Reply To: Repeater field returns nothing from a Template

  • That is the code that is in SideBarNav.php

    I’m not quite sure if it is loaded inside or outside the main loop. As bad as it sounds I’m not sure which is considered the main loop.

    So, I will post the code for the whole page here. This is code from the page the the template is being inserted into

    You will see <?php load_template( ‘wp-content/themes/modestclothes/SideBarNav.php’ ); ?>

    in the code below where the template should be loaded.

    <?php
    /**
    Template Name: Niche Page Template
     */
    ?>
      
      
      
      <?php get_header(); ?>
      
       <section id="PageContainer">
       
         
         <section style="background-image:url(<?php the_field("niche_header_banner_image"); ?>); background-size:cover; background-repeat:no-repeat;" id="NicheHeaderImage">
         
         <h1 id="NicheH1" class="MaxWidth"><?php the_field("niche_header_title");?></h1>
         </section>
         
         <section id="BannerHeaderSec" class="MaxWidth">
         
         <a href="<?php the_field("horizontal_banner_ad_url"); ?>"><img src="<?php the_field("horizontal_header_banner_ad_image"); ?>" alt=""/></a>
       	
    	
          </section>
          
          
          <section id="NicheSearchForm" class="col-lg-12">
                      <section id="NicheSearchFormContent" class="MaxWidth">  
                      			<h2 id="NicheSearchH2" class="text-center"> <?php the_field("SearchForTitle");?> </h2>
                                <section id="SearchBoxNiche"> <?php get_search_form(); ?></section>
                                
                       </section><!--NicheSearchFormContent-->
           </section><!--NicheSearchForm-->  
           
           
           <article class="MaxWidth">
              <section id="NicheSideNav" class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
               
                 	
                    <!--START of collapsible panels-->	  
                     <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
                          <div class="panel panel-default">
                            <div class="panel-heading" role="tab" id="headingOne">
                              <h4 class="panel-title">
                                <a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
                                  Current Page
                                </a>
                              </h4>
                            </div>
                            <div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
                              <div class="panel-body">
                                Anim pariatur cliche reprehenderit, 
                              </div>
                            </div>
                          </div>
    
    							<?php while ( have_posts() ) : the_post(); 
    							
    							{
    								    $Number = 1;
    									$Number++;
    									$Collapse = 'Collapse'.$Number;
    							}
    							
    							
    							?>
                    
                    
                                    <?php 
    								
    								
                    
                                    // check for rows (parent repeater)
                                    if( have_rows('niche_page_side_nav') ): ?>
                                       
                                        <?php 
                    
                                        // loop through rows (parent repeater)
                                        while( have_rows('niche_page_side_nav') ): the_row(); 
    							
    									?>
                                 
                                         
                                                
    											
    											
    										<div class="panel panel-default">
                                                <div class="panel-heading" role="tab" id="heading<?php echo $Collapse;?>">
                                                  <h4 class="panel-title">
                                                    <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse<?php echo $Collapse;?>" aria-expanded="true" aria-controls="collapse<?php echo $Collapse;?>">
    											<?php the_sub_field('links_nav_header'); ?>
                                                	        </a>
                                                      </h4>
                                                    </div>
                                                
                                                
                                               <div id="collapse<?php echo $Collapse;?>" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="heading<?php echo $Collapse;?>">
    											  <div class="panel-body">
                                                <?php 
                    							
    											
    											  
                                                // check for rows (sub repeater)
                                                if( have_rows('nav_links_list') ): ?>
                                                    <ul id="SideNavUl">
                                                    <?php 
                    
                                                    // loop through rows (sub repeater)
                                                    while( have_rows('nav_links_list') ): the_row();
                    
                                                        // display each item as a list - with a class of completed ( if completed )
                                                        ?>
                                                        <li class="CategoryListLinks"><a class="CategoryListLinksURL" href="<?php the_sub_field('nav_link_url'); ?>"><?php the_sub_field('nav_link_name'); ?></a>
                                                            </br><?php the_sub_field('category_description');?>
                                                        </li>
                                                    <?php endwhile; ?>
                                                    </ul>
                                                    
                                                    
                                                    
                                                                
                                                  </div>
                                                </div>
                                              </div>
                                                <?php endif; //if( get_sub_field('items') ): ?>
                                            
                    
                                        <?php endwhile; // while( has_sub_field('to-do_lists') ): ?>
                                     
                                    <?php endif; // if( get_field('to-do_lists') ): ?>
                    
                                <?php endwhile; // end of the loop. ?>
                                
                                
    
    				</div><!--END of Collapsible Panels-->
                        
                      
                       
                        
                        
                        
                        
              </section><!--NicheSideNav-->
              
              <section id="3SqureImagesSec" class="col-lg-8 col-md-8 col-sm-8 col-xs-12">
              
              	<section id="NicheSquareAd1" class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
              
    					 <?php         
                      
                           
                              if(get_field("niche_square_ad_1_url") && get_field("niche_square_ad_1_image"))
                                            
                            { 
    						echo '<a href="'.get_field("niche_square_ad_1_url").'"><img src="'.get_field("niche_square_ad_1_image").'" alt=""/></a>';
                           
                            }
                            
                            else {
                              
    						 echo '<a href="'.get_field("square_request_ad_image_default_url").'"><img src="'.get_field("square_request_ad_image_default").'" alt=""/></a>';
                            
                            }
    						
    						?>
    				
                  </section>
                  
                  
                  <section id="NicheSquareAd2" class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
              
    					 <?php         
                      
                           
                              if(get_field("niche_square_ad_2_url") && get_field("niche_square_ad_2_image"))
                                            
                            { 
    						echo '<a href="'.get_field("niche_square_ad_2_url").'"><img src="'.get_field("niche_square_ad_2_image").'" alt=""/></a>';
                           
                            }
                            
                            else {
                              
    						 echo '<a href="'.get_field("square_request_ad_image_default_url").'"><img src="'.get_field("square_request_ad_image_default").'" alt=""/></a>';
                            
                            }
    						
    						?>
    				
                  </section>
                  
                  
                  
                  <section id="NicheSquareAd3" class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
              
    					 <?php         
                      
                           
                              if(get_field("niche_square_ad_3_url") && get_field("niche_square_ad_3_image"))
                                            
                            { 
    						echo '<a href="'.get_field("niche_square_ad_3_url").'"><img src="'.get_field("niche_square_ad_3_image").'" alt=""/></a>';
                           
                            }
                            
                            else {
                              
    						 echo '<a href="'.get_field("square_request_ad_image_default_url").'"><img src="'.get_field("square_request_ad_image_default").'" alt=""/></a>';
                              
                            
                            }
    						
    						?>
    				
                  </section>
                 
                  
               
              
              
              
              
              
              
              
              
            <section class="ListsContainer col-xs-12">
    
                    
                        
                        <div id="SampleContent" role="main">
    
    							<?php while ( have_posts() ) : the_post(); ?>
                    
                    
                                    <?php 
                    
                                    // check for rows (parent repeater)
                                    if( have_rows('links_list') ): ?>
                                        <div id="to-do-lists">
                                        <?php 
                    
                                        // loop through rows (parent repeater)
                                        while( have_rows('links_list') ): the_row(); ?>
                                            <div>
                                                <h2 class="ListHeader"><?php the_sub_field('links_list_header'); ?></h2>
                                                <?php 
                    
                                                // check for rows (sub repeater)
                                                if( have_rows('links_list_items') ): ?>
                                                    <ul>
                                                    <?php 
                    
                                                    // loop through rows (sub repeater)
                                                    while( have_rows('links_list_items') ): the_row();
                    
                                                        // display each item as a list - with a class of completed ( if completed )
                                                        ?>
                                                        <li class="CategoryListLinks"><a class="CategoryListLinksURL" href="<?php the_sub_field('link_url'); ?>"><?php the_sub_field('link_name'); ?></a>
                                                            </br><?php the_sub_field('category_description');?>
                                                        </li>
                                                    <?php endwhile; ?>
                                                    </ul>
                                                <?php endif; //if( get_sub_field('items') ): ?>
                                            </div>	
                    
                                        <?php endwhile; // while( has_sub_field('to-do_lists') ): ?>
                                        </div>
                                    <?php endif; // if( get_field('to-do_lists') ): ?>
                    
                                <?php endwhile; // end of the loop. ?>
    
    				</div><!-- #SampleContent -->
                        
                    
    
            
               </section><!--ListsContainer--> 
              
              
              
              </section><!--3SquareImagesSec-->
              
              
              
          </article>
        
           
           
            
        		
    
    			<div id="content" class="site-content">
    
                
                    <div id="primary" class="content-area">
                    
                        
                    
                    
                        <main id="main" class="site-main" role="main">
                        
     
    
        
        <?php get_sidebar(); ?> 
    	
    
    		</main><!-- #main -->
    	</div><!-- #primary -->
      
    
    <?php get_footer(); ?>