List all ACF field values across every post on one page

by Joe Barrett   Last Updated June 12, 2019 23:08 PM

I used an ACF repeater field for data sheets/instruction manual download links of products in woocommerce. There's 50 products and each has 1 to 4 download links on their product page. I've been searching for a way to list all the links form all 50 products on one page the way you would query all posts on a page in a list. I don't even know where to start looking and I didn't see anything specific on the ACF forums.

Answers 1

You want to start here and here.

Essentially you're just looping through all your posts like normal and then adding some custom fields into it.

Be sure to reference the Repeater Field documentation.

This should work inside a loop. Notice you'll need your post ID.



        while ( have_rows('YOURREPEATERFIELDNAMEHERE', 'POSTIDHERE') ) : the_row(); ?>

            <li><?php echo get_sub_field('SUBFIELDNAMEHERE'); ?></li>

       <?php endwhile;

    else :

        // no rows found



    <?php endwhile; ?>
June 12, 2019 22:42 PM

Related Questions

Updated April 13, 2017 03:08 AM

Updated April 26, 2016 08:03 AM

Updated June 19, 2016 08:03 AM

Updated April 03, 2016 08:03 AM

Updated May 30, 2017 11:08 AM