Skip Navigation

[Resolved] Hide container if custom field is empty

This support ticket is created 4 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 4 replies, has 2 voices.

Last updated by Waqar 4 years, 6 months ago.

Assisted by: Waqar.

Author
Posts
#1869365
1869271-Screen_Shot_2020_12_08_at_1.21.30_PM.png

I have a section called, "Hobbies" and the section has 3 columns w/3 container blocks that the client can fill out for 3 hobbies
BUT, the client only has 2 hobbies and doesn't fill out the last custom field (on a form) for the 3rd hobby.
SO, I don't want that last column or container to show on the section on the front-end.

Would I use conditional shortcodes to manage this or is there a better solution? Perhaps you can point me in the right direction.

#1869441

Thank you. Could def use some help on this one.

#1869741

Hi,

Thank you for contacting us and I'd be happy to assist.

To suggest the best way to achieve this, I'll need to see exactly how these fields and container blocks are set up in the admin area.

Can you please share the temporary admin login details, along with the link to the example page where these blocks can be seen?

Note: Your next reply will be private and please make a complete backup copy, before sharing the access details.

regards,
Waqar

#1871975
Screen Shot 2020-12-10 at 10.51.09 AM.png

Also, I tried to use a Conditional Block and set it to :

Post Data
Current page
the custom field ("Virtual Me About")
Field ("hobbies")

and then set to "Empty"

Does this setup mean that IF the field ("Hobbies") is empty, (that the client didn't write anything in this box), it won't show?
and if the client DID write a hobby in this field it will show? (this is what I'm trying to get it to do)

Because right now it's not showing no matter what.

#1873031

Thank you for sharing these details.

I couldn't find any conditional block in the "Virtual Me Template" content template, but to show repeating items like hobbies in a grid layout, you can follow these steps:

1. Instead of using a multiple lines type "Hobbies" field, you can add a repeating field group in your post type "Virtual Me":
https://toolset.com/lesson-placement/lesson-placements-1621067-1624449/#creating-repeatable-field-groups

In that field group, you can include single-line type custom field "Hobby Name". This will allow you to add multiple hobbies with each "Virtual Me" post.

2. After that, in your "Virtual Me Template", you can include "View" to show these new hobby repeating field group entries, in a grid layout through a "Single Field" block:
https://toolset.com/lesson-placement/lesson-placements-1621067-1624449/#displaying-repeatable-field-groups

I hope this helps and please let me know if you need any further assistance around this.