Home › Forums › Add-ons › Repeater Field › Repeater field returns nothing from a Template › Reply To: Repeater field returns nothing from a Template
Sorry, I forgot that I copied the code from the template and started working on it directly in the page.
Here is the code with the load template function in it.
<?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">
<?php load_template( ‘wp-content/themes/modestclothes/SideBarNav.php’ ); ?>
</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 -->
<script>
// Sets interval...what is transition slide speed?
$('#myCarousel2').carousel({
interval: 3000
});
</script>
<?php get_footer(); ?>
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!
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.