Home Forums Add-ons Repeater Field Repeater From Another Page


Repeater From Another Page

  • So I’m using the $other_page to set a page ID but I need to use it in a repeater in my page template:

    $other_page = 934;
    $rows = get_field('myrepeater', $other_page);
    	foreach($rows as $row)
                 echo '<div class="toggle"><h3><a href="#">' . get_sub_field('current_month') . '</a></h3>
    		<div> Shortcode will be in here </div></div>
    		<a href="' . get_sub_field('field_url') .'&output=csv">Download CSV</a></div>';
    } ?>
    <?php endif; ?>

    it breaks the page. Any ideas anyone? Would be appreciated.

    • Elliot

    • November 13, 2013 at 4:03 pm

    Hi @phil.owen

    The get_sub_field function can ONLY run within a have_rows or has_sub_fields while loop!
    Please read the docs to get a better understanding for this.


  • Yeah I got it working now. Thanks man.

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

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.