Support » Plugin: Simple Staff List » How I do pseudo-conditional fields

  • Resolved Matt Cromwell


    For such a great plugin it seems a shame the author doesn’t have the time to support it. I saw this ticket was closed without an answer, and I really needed this too. So this is what I did to hide the social media links if the staff member didn’t have FB or Twitter:

    First, in the template loop, I wrapped the whole FB icon with the link and gave it an ID that included the link itself, like so:

    <a href="[staff-facebook]" target="_blank" id="fb-[staff-facebook]"><i class="dashicons dashicons-facebook"></i></a>

    So if the staff person doesn’t have a Facebook account to link to, the ID for that icon will ALWAYS be the same, meaning id="fb-".

    Next, in my stylesheet I used selectors to hide that id, like so:
    .staff-member-info-wrap a[id="fb-"] {display: none;}

    Did the same thing with Twitter and now they’re all hidden. Of course I’d prefer if the markup was never output in the first place, but until the author can build in conditional fields, this is what I’ll be using.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi webdevmattcrom 😀 This sounds like a potential solution for my issue as well.

    What I would like to do is to be able to hide or show an email icon depending on whether the email has been entered or not.

    Currently, the code I am using to show the email icon is this:
    <p class=”staff-name-email”><img src=””/><p>

    So, it displays on the page like this:

    What I would like to be able to do is, if the email for a particular staff member hasn’t been entered, the email icon and the email will not be displayed. If the email has been entered into the Staff Info email field, the page will display the icon linking to the member’s email adress provided in the Staff Info email field.

    It would be great if I could have the response within the next 24 hours, as I am quite in a hurry for this 🙂

    In any case, thanks very much!



    Hi Mirta,

    Just a reminder that I’m not the plugin author, I just shared my solution because I figured it would be helpful for others as well. Happy to help quickly:

    In your template you should do something like this:
    <p class="staff-email email-[staff-email]"><img ... ></p>

    Then in your css:
    p[class="email-"] {display: none;}

    That’s it!

    I know you aren’t the plugin author, but I thought you might have the idea about that issue as well 😀 Thanks for the code 😀

    Plugin Author Brett Shumaker


    Hi Matt –
    That’s a great work-around. I’m working on a small plugin update that I’ll be putting out this week that will include conditional checks before outputting fields.

    Just a note, though, that if you use a custom link structure (or custom markup for ANY staff field) in your staff loop template, I can’t conditionally check for that since the staff loop template is applied to all staff members. I can only check to see whether or not the staff member has a particular field entered in their post.


Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How I do pseudo-conditional fields’ is closed to new replies.