How to "remove" a section, row or column if there is no content

I have a situation that you can see here: https://www.loom.com/share/243d85ce5637417f9cf2e91580499a4e

Or directly here: https://lazy-turtle-ij6opxys.sandboxcms.com/product/filmtec-bw30hr-440/

you can see that in the body of the page there’s a row with 2 columns. i’d like to hide that column or well make it so the other column takes over if the gallery on the first column is empty.

However, i can’t find a way to do so. I can write code if needed, i would just need info about WHERE should i hook anything, how could i get such thing as the info on that column.

Can you help me by pointing me in the right direction?

Hey @franticape,

have you tried conditions on that column? Not sure if works, but I would try to add a condition check on that column you want to hide. In that condition check, if the gallery = {{dc:param:item}} is not empty. So if the {{dc:param:item}} is empty, the column should not be added to the DOM.

As far as I have seen in your video you might have to rearrange your Looper Provider somewhat higher in the hierarchy. I.e. Looper Provider on the section. And Looper Consumer on the row if this makes sense in your situation.

can you explain what would “{{dc:param:item}}” be? should it change or is it a specific parameter defined by cornerstone? where can i find more info about it? i guess in the parameter doc but i gave it a look and didn’t find it, can you point me to the specific section?

Hello @franticape,

Thank you for the very detailed presentation. Yes, that is possible. You just have to do this:
1.) Move the Looper Provider to your Row or Section element
2.) The Looper Consumer stays on the Slide element
3.) Add an element condition “Looper Provider Output IS NOT Empty” in the first Column element.

Hope this makes sense. Kindly let us know how it goes.

Ah! Very nice @ruenel. Didn’t know about the Looper Provider Output condition. Still so many details you can learn even after working many years with Pro Theme :smile:

Hi @raye,

You are most welcome.

I tried that and i wonder if there’s a way to actually check the value from the provider because when i add it as you mention, it always shows it, even when the gallery is actually empty.

I tried with different settings in ACF for the gallery field (array and URL) , however it seems the result is always the same for the provider.

here’s how the setup looks like: https://www.loom.com/share/2c0fdf398bc24873b4f6707f3d7588df

When the gallery has content it returns an array and it returns FALSE otherwise, so i wonder why the provider output is not working.

EDIT:

I made it work in a different way, by using the “string” condition: https://prnt.sc/zLQ0Bbz7KPmF

(empty) IS NOT (acf gallery field meta).

From this i have a question: How can i check the provider output to see why the condition returned the same value every time?

Hey @franticape,

It’s hard to know the reason why it’s the same value every time without checking the actual ACF output.

Alternatively, you can try using {{dc:looper:count}} == 0 to check if the Looper Provider has no or 0 output.

image

If that doesn’t help, you can provide us with WP Admin access in a Secure Note so we can check.

Have a nice day!

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