Tagged: acf, ALB, conditionnal, CPT, custom fields, custom layouts, display
-
AuthorPosts
-
December 5, 2024 at 5:49 pm #1473027
Hello everyone,
I’m really happy with this “Custom Layout” feature that I use with ACF to make CPTs. :-)I have over a hundred entries (from the same CPT) that use the same Custom Layout except that one of the ACF custom fields is sometimes empty (and filled in most of the time).
As this is a link that I’m displaying in a button, I’d like to be able to display the button only when the field is filled in, otherwise it creates a bad user experience.
I couldn’t find in the documentation for Custom Layouts with ACF how to make the display conditional (when the field isn’t empty). Is there any way of doing this?
Best regards
December 9, 2024 at 6:29 am #1473206Hey Arsène,
Thank you for the inquiry.
Where can we check this? Unfortunately, there is no option to add conditions to the dynamic data, as it assumes that all data should be filled or contains a value.
Best regards,
IsmaelDecember 9, 2024 at 4:00 pm #1473251Hi Ismael,
The case I’m dealing with is fairly straightforward and is likely to recur quite often among Enfold users.Typical example:
- I’m using a Custom Layout to display a company directory via a dedicated CPT.
- For each company listing I can fill in 2 custom fields for their links to the company’s social networks (let’s say LinkedIn and Facebook, to keep it classic).
- How do I handle the display of data depending on whether or not companies have links to provide for each of the three custom fields?
If you have any recommendations on how to handle this situation, I’d love to hear from you.
For the moment, I’ve created duplicates of my Custom Layout to correspond to the 4 possible scenarios (no link, only link 1, only link 2 or both links). With only a hundred or so entries, I was able to manually set the appropriate Custom Layout, but this would be very complicated for several thousand entries. I’ll need a conditional display solution.
Best regards,n
December 11, 2024 at 9:28 am #1473404Hi,
Thank you for the info.
We understand what you’re trying to achieve, but unfortunately, this option is not available at the moment and would require a significant amount of modifications to include it in the theme. It’s good to know that you’ve found a workaround — please continue using it for now.
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.