Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #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

    #1473206

    Hey 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,
    Ismael

    #1473251

    Hi Ismael,
    The case I’m dealing with is fairly straightforward and is likely to recur quite often among Enfold users.

    Typical example:

    1. I’m using a Custom Layout to display a company directory via a dedicated CPT.
    2. 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).
    3. 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

    #1473404

    Hi,

    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

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.