Hi Guys!
Im using ACF to build custom widgets for my template. I just tried to use Repeater field in a widget, but for some reason I couldn’t get the values.
My code:
($wid equals to “widget_” . $args[“widget_id”])
<?php if( have_rows('buttons', $wid) ): ?>
<div class="buttons">
<?php while ( have_rows('buttons', $wid) ) : the_row(); ?>
<a class="btn <?php the_sub_field("layout"); ?>" href="<?php the_sub_field("button_link"); ?>" title="<?php the_sub_field("button_text"); ?>"><?php the_sub_field("button_text"); ?></a>
<?php endwhile; ?>
</div>
<?php endif; ?>
The if statement is true, but then the while statement do nothing.
Am I missed something and repeater field is not compatible with widgets?
Thanks,
Robert
It was my bad. Sorry. Code works like charm.
If you make a lot of widgets, check out http://acfwidgets.com
Cheers!