Support

Account

Home Forums Add-ons Repeater Field Repeated Div won't display on the website

Unread

Repeated Div won't display on the website

  • Hello to everyone here, I’m trying to use the repeater’s Advanced loop but I can’t get to make it work. It shows properly in the Edit page but when I load the website it will just omit the whole row, asi if nothing is there. Here is my code:

    <?php if( have_rows('mainnews_repeater') ): ?>
    
    <!-- START Main News Container --><div class="row mainnews">
    
        <?php while( have_rows('mainnews_repeater') ): the_row(); 
                
                // vars
    		$image = get_sub_field('mainnews_image');
    		$title = get_sub_field('mainnews_title');
    		$link = get_sub_field('mainwnews_link');
            $tag = get_sub_field('$mainwnews_tag');
               
    		?>
        
    
     <!-- START 1st Main News -->
        <div class="col-xs-12 col-sm-6 col-lg-3">
            
            <?php if( $link ): ?>
            <a href="<?php echo $link; ?>">
                <?php endif; ?>
                
                <div class="contimg"><img class="img img-responsive" src="<?php echo $image['url']; ?>" alt="Generic placeholder image"></div>
                
         <div class="conttxt">
                    <h2><?php echo $section; ?></h2>
                    <h1><?php echo $title; ?></h1>
                </div>
            </a>
        </div>  <!-- END 1st Main News -->
    
        <?php endwhile; ?>
    
    </div><!-- END Main News Container -->
    
    <?php endif; ?>

    If I change <?php if( have_rows(‘mainnews_repeater’) ): ?> to inside <div class=”row mainnews”> , the page will at least show a gap where the row of cols it’s supposed to be but still it won’t show my custom fields.

    I followed the documentation but I think I may be missing something very obvious but I can’t figure out what. I hope anyone here can give some advice, thanks in advance.

Viewing 1 post (of 1 total)

The topic ‘Repeated Div won't display on the website’ is closed to new replies.