ACF Repeater: some questions

Hi @alexander!

I am sorry for asking without testing.

Integrating the Repeater field is a huge thing. I have some practical questions.

  1. Imagine we decide to build a “Meet the team” page using the ACF Repeater instead of the CPT’s. Let’s say that one of the repeated fields is a checkbox that indicates the availability of individual team members. There should be a condition on an element that reads the checkbox status for each of the members and shows the appropriate status indicator. I guess this is straightforward, but just checking. :slight_smile:

  2. Imagine that another repeated field is a dropdown with three options. Let’s say they are “Sales” “R&D” and “Support”. Would it be possible to create three loopers on the page, each grouping one of the three, based on the dropdown status?

  3. This one is not about the repeaters. It is the concept of nested loopers. I saw something similar with the terms, and figured if this would be possible:

Imagine an archive page that is grouping posts based on the categoires. The more categories, the more groups. So perhaps a Section is a provider, and each Row is a different category. Inside the Rows, each column is a post from that category.

From the practical standpoint, such page probably wouldn’t display all the categories, but only those that are set as highlighted (using ACF). Also, each category would display only few latest posts, and the “See all” button would lead to the Category page. Also, each row would also had to show other dynamic elements like the Category title.

Thanks!

Hi @Misho,

Sure! I can comment on these:

  1. Yes! Should work just fine if you set the checkbox value to something like “Available” and conditionally check if the DC is equivalent to that string.

  2. Unfortunately I don’t think this is possible at the moment, at least not fully dynamically. You would need to be able to access data from two different looper providers to setup the right element conditions. I would recommend doing it like this:

  • Add a Team Repeater field and include the dropdown with the different departments
  • Add an element to your page that loops over team and conditionally shows some kind of layout element like a row if the current team members department is “Sales”
  • Once that section is designed, duplicate it and update the element condition for the other departments

It’s a bit more to setup, but would at least keep your ACF Repeater as simple as possible. It would be easy to manage moving team members between departments this way instead of managing them in separate repeater fields per department.

  1. This one is a bit out of reach as well because of the issue above where you don’t have the previous looper data available. Also, the query builder doesn’t support dynamic content yet. We want to make access to that data available, but haven’t committed to a path forward yet.

Something that might help creating complex archive pages: One hidden feature that we’ve not added to the UI yet is the ability to rewind a looper. It can be found in the dev console while inspecting an element. When enabled on a consumer, it will move the looper provider back to the start position when it is done consuming items. This can be handy if you want to create an archive page and split posts into different parts of a layout without causing another WordPress query to run.

2 Likes