Home Forums Add-ons Repeater Field Hiding repeater field


Hiding repeater field

  • Hi,
    I have the following setup for my page:

    – A general page template with an element i want to show on some pages (repeater).
    – I have set it up so you can only fill it in in some pages.

    This works. Only it doesnt work in this case, where i had it on the page before but now i want to remove it. I made the field empty and made it dissapear from the backend for that page. But the html is still visible on that page.

    This is my code:

    <?php if( have_rows('stats') ): ?>
    					<div class="container main-content-stats pl-4 pr-4">
    						<div class="row stats">
    						<?php while( have_rows('stats') ): the_row();
    							$name = get_sub_field('title');
    							$number = get_sub_field('number');
    							<?php if( get_sub_field('title') ): ?>
    							<div class="col-6 col-md-6 col-lg-3">
    								<span class="count"><?php echo $number; ?></span>
    								<p><?php echo $name; ?></p>
    							<?php endif; ?>
    						<?php endwhile; ?>
    					<?php endif; ?>

    The outer container divs are still visible

  • You need to make the fields empty and save the page first before removing the fields completely, otherwise there will still be something in the database that triggers the have_rows condition.

  • To add add onto what @vipstephan said, it’s not enough to clear the fields inside a repeater row, you have to delete the actual row(s)…the little red circle with the minus symbol on the right hand side of the row (when hovered over).

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Hiding repeater field’ is closed to new replies.