Tell us what you are trying to do?
I created a custom type field named Promotions (Promoções) with a radio for Yes or No (Sim or Não). If chosen Yes, then it would display custom type multiple lines named Promotion (Promoção), where the user can include their promotions.
The show/hide condition was implemented in the custom type field group for Promotion and it works great on the back-end. But in the front-end, I'm using Elementor dynamic link to show the Toolset Promotions, but it should not show when the user switches from Yes to No.
Attached are the images to show what I meant. How do I hide that section when the user decides to choose No for the promotions option?
What you need to do is to wrap this section on your template in a conditional code to check if No is actually selected on the post.
It wont be done automatic on the frontend like with the backend.
So that is done. The only thing is that it creates an unnecessary space. I believe it's because of the div. I tried using CSS to hide the div, but it only hides and not remove it.
div:empty {
display: none;
}
Is there a function in php where I can delete the div so there isn't any space showing?
I contacted Elementor and they do not have a way to hide empty fields yet. So I'll have to find a custom javascript or function to do it.
But after Elementor's upgrade, it's now having conflicts with Toolset Views, Forms, and Type plugins. I contacted them and gave them my credentials to check out the site. I cannot do anything right now, I need to wait for them to fix it.
This page has all the custom fields filled in - hidden link
While this page, I purposely did not fill in the phone numbers so I can see how it looked if someone does not fill the custom field - hidden link