In many cases, we tend to need custom condition where we can hide an element or a complete section if the ACF field is empty or not set. For example, we have a single post template with coupons which are coming from acf fields. However, in the post we don’t have coupons. As such, you will either need to hide the heading in your template file for coupons. Or you will need to hide the complete section for coupons in your template file. So, in this video we will see how to hide your section if there is no value in your acf custom field.
Steps to Hide Section or Element If ACF Custom Field is Empty:
For example we need to hide the complete section if ACF field is not set or empty
- Make sure you’ve installed Dynamic.ooo on your website
- Click to Edit your section
- Go to visibility tab
- Enable visibility for show toggle
- Enable “Post” visibility trigger
- Go to Post Visibility settings > Post Field and choose your meta key for which you want to show/hide the section
- As you choose the meta key, you will be able to see more option below under Post Field Status
- Choose “Valorised with any value” option under Post Field Status
- Now Update the Template
- Congratulations! You’ve successfully hidden the section where the ACF Field is not set.
With the given video, you can also see the live example of how to hide the section whenever your ACF field is not valorized with any value in backend.
Don’t hesitate to subscribe us for the latest & exciting posts and deals
I love to explore the possibilities and android is full of it. I firmly believe that An ego is never an amigo. Apart from writing, I love to sing and design. If you like this article, don’t keep this to yourself and spread the words to your friends on social media. You can also connect me via social media.