Hierarchical taxonomy is empty - how to tell the looper?

I have created a hierarchical taxonomy. Posts with this taxonomy can have zero to many terms applied to them. I want to output the terms of that taxonomy in a post (I am using the Pro-provided element “Terms (minimal)”. The Looper query returns the terms in an array. This array has the length 1 when one term is applied, length 2 for two terms, and so on. The problem is when no term is applied to the post, then the returned array also has length 1, it is just that this first entry has nothing in it (well, it has BOOL(FALSE) in it). This can be seen in the following screenshot, showing the output of {{dc:looper:debug_provider}}. The “1” at the bottom of the screenshot comes from {{dc:looper:count}}.

image

I want to apply a condition to not show the Row with the terms when there are no terms. “Provider not empty” does not work as a condition, because the provider is never empty. “Looper Count” > 0 doesn’t work either, because the looper count is 1 for both 0 and 1 terms. Can you please point me in the right direction for an appropriate condition to use?

If your array is [false] and you want to hide if false is in the array you can use something similar to the screenshot. You could also use [false] is {{dc:p:json type="json"}} instead of in. How were you building the provider? Thanks.

image

Hi @charlie, this is how the looper provider is set up:
image
“Applications” is a custom Taxonomy, added to Wordpress via CPT UI .

This is the output of {{dc:looper:debug_provider}} when there is one term applied. Please note that the size of the returned array is 1, just as in the screenshot in my initial question, where no term was applied to the post.

Hello @striata,

The Looper Provider Current Post Terms should display at least one term if there is only one assigned to the post item. Can you please provide us the URL or an access to the page where we can check your Looper Settings? 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

image

Thank you in advance.

Dear @ruenel, the Looper provider works perfectly fine in what it displays or doesn’t display. This is not my question. I don’t think that there is a bug there. Below the structure I have. The row is set up as a provider (for “Current Post Terms”). It also has a condition on it (which doesn’t work), to only display when there actually are terms to display.
The first column in the row (green rectangle) shows the “headline” for the terms, the second column has the consumer on it, to display the actual term(s). In the example screenshot, there is one term (orange outline). When there are 2 or more terms, it will display all those terms - perfectly fine. When there are no terms, it will display no terms.
image
My question is about the condition. What condition do I have to use so that the entire row only displays when there are terms? I don’t want the titel “Related Products” to show up, when there are no related products.

The provider output itself is never empty, it always returns an array. So, the condition “Looper Provider is not empty” doesn’t work to hide the row when no term is assigned to the current post. When terms are assigned, then this array has the length corresponding to the number of terms, and for each term it contains an object (see my screenshot further up in reply to @charlie’s comment, with an example where a single term has been applied). However, if no term is applied to the post, the returned array also has length 1. Now, the one entry is not an object, but BOOL(FALSE) (see the screenshot in my initial question).
So, again, my question is which condition needs to be used on the provider.

Hey @striata,

You can use the Looper-related conditions which you can add in your “Row: Related Products” element:

If this does not help, please provide your WP access so we can check your Looper settings.

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