How to hide section when looper provider does not return a result

Hello,

I thought it was possible to hide an element that has a looper provider with no results (it seems to have been added in Pro 4.1 as answered in this post: Hide section when looper provider does not return a result).

I have tested the condition on an looper provider set on an empty Repeater field and it did not hide the element.

Can you help on this matter? Thanks

Hello @STUANDCO,

Thanks for writing to us.

You can use the dynamic content code {{dc:looper:item}}, it would return the number of items for the looper. I would suggest you check the condition as if the items is greater than 0

Please have a look at the given screenshot below.

Hope it helps
Thanks

Edit : Thank you for your answer, it worked

Hi @STUANDCO,

Glad that we are able to help you.

Thanks

Correction: sorry for the confusion but this solution does not work, actually.

I thought the element was properly hidden but in fact, {{dc::looper::item}} seems to be empty whatever the number of elements in the repeater is, and the test you suggests will always return false.

I can provide you a test site if you want to test my setup.

Hello @STUANDCO,

To better assist you with your issue, please provide us access to the site and to which page you are editing so we can check it. You can create a secure note in your next reply with the following info:
– Link to your site
– WP login URL
– WP username
– WP password
– WP Administrator Role
- Confirmation that we can access and make changes to your site

To know how to create a secure note, please check this out: How The Forum Works

Best Regards.

Hello,
Here find an admin access to my test site.

Thanks.

Hello @STUANDCO,

You should be using {{dc:looper:count}}.

Kindly check out the example URL in the secure note below.

Best Regards.

Thank you for your answer.

I take note that it works in your example on a looper type “query builder”.

My question is about “dynamic content” type using a repeater. And {{dc::looper::count}} does not return the expected value in this case (I have added some texts in blue to display this value at different locations - It should display 0 or 3, but not 1).

My guess is : the condition “provider output => is/is not empty” and the variable {{dc::looper::count}} are set as soon as the looper is initialized if the looper is of type “query builder” but not when of type “dynamic content”.

When using dynamic content, the looper is not initialized before being consumed, and {{dc::looper::count}} returns the number of item of the ancestor looper (here, the main wp query, with only 1 post).

Am I right ? If so, can it be fixed so the looper output can be tested whatever the looper type is ?

Hi @STUANDCO,

I have checked your website and found that you are using the ACF field for the Dynamic Content in the Looper. This is a known issue with the ACF and the Provider Empty condition in the latest version of the theme and has already been reported to our issue tracker for further investigation by the development team.

Thanks

Thanks !
Can you make sure it is also reported that dc::looper::count does not return the expected value.

Edit : Are known issues listed somewhere? I wish i had known the issue beforehand so i would not have spent time trying to make it work.

Hi @STUANDCO,

I have added your thread into the same issue so our development team can check it.

Thanks

Great, Thanks.

Hi @STUANDCO,

You are most welcome.

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