Home Forums ACF PRO Widget Field and Repeater field together


Widget Field and Repeater field together

  • 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; ?>
    <?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?



  • It was my bad. Sorry. Code works like charm.

  • If you make a lot of widgets, check out


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

The topic ‘Widget Field and Repeater field together’ is closed to new replies.