Empty Looper Conditions not working in Layout

So I’m working on a layout for project pages, which includes a couple of sections for Awards and Testimonials, fed by ACF Repeater fields on each project. I’d like to be able to hide those when their respective loopers return nothing, but that so far hasn’t been working for some reason.

Awards Setup

Div (Looper provider: {{dc:acf:post_field field=“awards”}} )

Text (“Awards” heading)
Text (Looper consumer - Award details)

The “Award details” text element naturally does not display when the looper is empty, however I can’t get the “Awards” heading to also be hidden in that scenario.

Testimonials Setup

Row (Looper provider: {{dc:acf:post_field field=“testimonials”}} )

Column > Slider > Container, etc.

Slide (Looper consumer)

With both of these, I’ve tried the conditions Provider is not empty and {{dc:looper:count}} > 0 on the provider element, and on those non-consumer elements also tried simply {{dc:acf:post_field field="[name]"}} is not [blank] —no luck. Will you please advise as to how I can hide those elements entirely when those repeaters are empty?

Credentials and page links provided in a secure note—thanks!

Hi @2020creative,

Thanks for reaching out.
I have checked the Projects DYNAMIC layout and investigated all the Looper Providers and found the condition with {{dc:looper:count}} > 0 or {{dc:looper:count}} > 1 is working perfectly fine.

I have duplicated the same Layout for further investigation and the result was the same. I would request you specify the exact section where you are having the problem so we can recognize the issue by investigating that.
Thanks

Thanks for checking, Tristup. The issue is with the Row, “QUOTE” which you highlighted in that screenshot, and the Div “Awards” within the sidebar.

You’ll see in this screenshot—this test project has no Awards or Testimonials added to it via ACF, however those elements are still appearing when I need them to be hidden (i.e. the heading “Awards” in the sidebar should not appear, and the entire “QUOTE” row with a blue background should not appear)

Those looper providers appear to be specifying the correct fields, but it seems as though ACF is not returning a ‘0’ value for the looper count? Either that, or maybe I’ve simply set up the conditions improperly.

Hey @2020creative,

Provider is not empty is supposed to be the Condition but since it does not work, remove the Looper Provider Condition and wrap your elements in a Div element and make the Div a Consumer.

image

Then, for your static elements like the Awards text, set this Condition:

Consumer Output is Initial

image

What that will do is output the element only once.

image

I’ve applied that to your Awards to show you how it works. Please apply that technique to your Quote/Testimonial.

Thanks.

Thanks Christian—just to clarify, is the “Provider is not empty” condition not working due to a bug, or something to do with how I’ve constructed these elements? In any case, your solution works perfectly for the Awards, however I’m not sure that it works as-is with the quote/testimonial slider?

I attempted this with a div set as a Provider for the Testimonials repeater, then the Slider as a consumer. That of course doesn’t work as it just repeats the entire slider with a single slide for every item. However I did also try setting looper_consumer_rewind to “True” on the Slider, in hopes that the Slide consumer within that would then work, but that didn’t seem to help. I’m afraid I’m not understanding how to apply your solution to this element, as the structure of it is a bit more complex than the Awards portion of the page—please advise.

Hey @2020creative,

It might be related to a bug.

Your setup works with the exception of the Content Wrapper having a padding which it shouldn’t so that if there is no slide, nothing will be displayed visually. The padding must be applied to the Slide element.

Take a look at the duplicate (top slider) I did to see the setup that I mean.

Hope that helps.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.