Condition on looper provider

Good day! I have a looper provider to show posts. Within each item, I have a nested provider to display this items terms. The latter is the native “Terms (minimal)” element provided with Pro, with the Provider being set to “Current Post Terms”, but otherwise unchanged.
Not all of the posts have terms associated with them. These posts have an empty space in the design where the terms would normally be, which does not look nice. I therefore wanted to exclude the “Terms (minimal)” element by setting a condition on it, to only show when “Provider Output” “is not empty”. See screenshot. But this doesn’t work.
I wondered if it is maybe looking for the Provider output of the parent looper, rather than the provider defined in the very same element. Whatever the case might be, how to solve it?

Hello @striata,

Thanks for writing to us.

You need to set the condition like this `“Provider Output is not empty”.
Test-Page-Builder-Pro (100)

In case you have not seen our doc of condition and assignment please have a look at it.
https://theme.co/docs/conditions-and-assignments

If it doesn’t work for you, please share your details in a secure note. Please provide the following details

  • WordPress Login URL
  • Admin level username and password
  • Exact page URL

You can find the Secure Note button at the bottom of your posts

Thanks

Thanks for your reply! This is literally whaat I have done, and I have asked in my question why it does not work.

Are you reading anything that I have written?

Hello @striata,

Sorry for the confusion, I have tested my end on my localhost, and seems that it is working fine at my end. In order to help you with your concerns, we need to check your settings I would suggest you please share your admin login details so that we can check them at our end.

Thanks

In my testing I have coome so far as to conclude that it is actually not technically empty, even though it is. It is a custom term, and I might have it set up wrongly to always return something.
There was a way of printing the provider output in a text or raw element for debugging purposes. Can you provide me with a link to the post by Kory or Alexander that showed this, or paste it in here?

Okay, I found this one.
By the way, it happens both for custom taxonomies, and for standard taxonimies. When the looper provider is not empty, then {{dc:looper:count}} shows the actual number of entries for non-empty providers (e.g. “1” when thre is one item), but it also shows “1” when it the provider is empty. Below are the outputs of {{dc:looper:debug_provider}} when there actually is one item to be returned, and when there is no item to be returned:

Type: Cornerstone_Looper_Provider_Terms
Size: 1
Current Data:
array(1) {
  [0]=>
  object(WP_Term)#29461 (10) {
    ["term_id"]=>int(110)
    ["name"]=>string(17) "Neuroinflammation"
    ["slug"]=>string(17) "neuroinflammation"
    ["term_group"]=>int(0)
    ["term_taxonomy_id"]=>int(110)
    ["taxonomy"]=>string(11) "application"
    ["description"]=>string(0) ""
    ["parent"]=>int(0)
    ["count"]=>int(7)
    ["filter"]=>string(3) "raw"
  }
}

The empty one:

Type: Cornerstone_Looper_Provider_Terms
Size: 1
Current Data:
array(1) {
  [0]=>
 bool(false)
}

More remarks: This is in a global block. I have not yet inserted that globol block design on a page to look how it would look on the front end.

Hello @striata,

We would love to check your Looper settings and investigate your issue further. Would you mind providing us your log in details and the name of the Global block where you have your Loopers added? 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

Thanks.

See secure note above for login details.

Here is the relevant part of the global block:
image

The two rows “Row: Related Products” and “Row: Applications” show the problem.
The first (“Products”) is basically the built-in “Terms (minimal)”
For the second, I embedded that into a Div and moved the Looper Provider to that Div, so that the Condition (Don’t show when Provider is empty) is one level below the provider. That didn’t solve the problem.

The text field within “Column: Titel” in the second provider (“Applications”) also contains the {{dc:looper:debug_provider}} and {{dc:looper:count}} for debugging purposes.

The second consumed post has empty “Products” and empty “Applications”, so this post should not show the “Products” and “Applications” lines. But it shows both of them.

Hello @Striata,

The Looper Provider Output condition is working on my test page. You can check out the link in the secure note.
It could mean that there is something wrong with how you have structured your elements and the Looper Provider present on the page which you are having the issue now. As you have nested the elements, it may have been in conflict with one another. I would recommend that you recreate the page to a new one with a top to bottom structure.

Best Regards.

Thank yuo, @ruenel
I have adjusted your example slightly (the one you linked to, on the second half of the page). I hava taken the “Recent posts”, and added to each posts its terms (as two separate loopers, “Products” and “Applications”). The first post has no “Applications” associated, but it still shows. Same problem as before.

Hello @striata,

I added an offset and it seems it is working. Can it be that there is something wrong with the first item? If we can exchange the dates of the first and 3rd items, maybe we can double check it.

Thanks.

Hello @ruenel,
the first post was the only one with empty “Applications”. After adding the offset, you did not see another one that was empty.
Here is an idea: Both the “Products” and the “Applications” are hierarchical Taxonomies, similar to standard " Categories" Taxonomy. I checked to see if the same problem would occur when I did not assign a category to the post. However, this doesn’t work: Wordpress automaticially assignes “uncategorized” as category, and does not let me remove it. In this case, one can NEVER have an empty list of categories! (I did that on the third post, you can check the test page) While the “Product”/“Application” CAN be empty. The query returns an almost empty array of size 1, but it DOES return that array.
So, I do think that it behaves “properly” as it is programmed, but that is is actually a fringe condition that should be taken care of (because it sort of is an empty provider)

This is copied from above:

Type: Cornerstone_Looper_Provider_Terms
Size: 1
Current Data:
array(1) {
  [0]=>
 bool(false)
}

The condition “empty provider” is therefore never triggered here. Is there a String-condition or similar that I can use as a fallback, to test if the first entry of the returned array is bool(false)?