Adding an inline conditional to a modal toggle text

Hi,

I am doing a modal for a staff page. I’d like the Secondary Title to show both an organization and a title. However, not every staff member has an organization or a title. Usually, I can set this conditional the normal way. But because I’m using a modal for this, I can’t set the conditional.

My secondary text is set to this:
{{dc:acf:post_field field=“organization”}}
{{dc:acf:post_field field=“staff_title”}}

However, when one of those fields is blank it leaves a gap in my layout.

Thanks for any help,
Jen

Hello Jen,

Thanks for writing in!

In this case, you can use the CSS :empty Psuedo Class; https://www.w3schools.com/cssref/sel_empty.php

For example;

.x-anchor .x-anchor-text span:empty {
    display: none;
}

When the Primary or Secondary text has no contents, then it will not display. Hence, it does not leave an empty gap in your layout.

Be advised that custom CSS coding is beyond the scope of our support. The code above is a mere sample code which may or may not work out of the box.

Best Regards.