Hi guys, I’m just a beginner, and need help.
I creat the repeater fields but dont show on page.
pls I need help.
I need to register something in funcitions.php or just use the code on page?
(admin image: https://i.imgsafe.org/e45b6189a1.png )
and in my homepage I put the code:
<div class="container">
<div class="row">
<?php
// TO SHOW THE PAGE CONTENTS
while ( have_posts() ) : the_post(); ?> <!--Because the_content() works only inside a WP Loop -->
<div class="entry-content-page">
<?php the_content(); ?> <!-- Page Content -->
</div><!-- .entry-content-page -->
<?php
endwhile; //resetting the page loop
wp_reset_query(); //resetting the page query
?>
<?php if( have_rows('repeater_slides') ): ?>
<ul>
<?php while( have_rows('repeater_slides') ): the_row(); ?>
<li>sub_field_1 = <?php the_sub_field('imagem'); ?>, sub_field_2 = <?php the_sub_field('titulo_do_slide'); ?>, etc</li>
<?php
$sub_field_3 = get_sub_field('sub-titulo');
// do something with $sub_field_3
?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</div>
</div>
</div>
Hi @royroy2
No you do not need any code in functions.php.
To fix your code, please call the repeater loop from within the main posts() loop here:
while ( have_posts() ) : the_post(); ?> <!--Because the_content() works only inside a WP Loop -->
<div class="entry-content-page">
<?php the_content(); ?> <!-- Page Content -->
</div><!-- .entry-content-page -->
<?php
endwhile; //resetting the page loop