Support » Plugin: Simple Staff List » Staff loop template (if option)

  • Resolved bcpen

    (@bcpen)


    Can someone give me some direction how to check if bio is empty do not show the link to the bio in the staff loop template?

    [staff_loop]
    <a href="/staff-members/[staff-name-slug]">
    <img class="staff-member-photo" src="[staff-photo-url]" alt="[staff-name] : [staff-position]"></a>
        <div class="staff-member-info-wrap">
    <a href="/staff-members/[staff-name-slug]">
    
            [staff-name]</a><br>
            [staff-position] <br>     [staff-email-link]  [staff-phone]
    <a href="/staff-members/[staff-name-slug]">
    [staff-bio]
          
        </div>
    
    [/staff_loop]
    • This topic was modified 2 months, 3 weeks ago by bcpen.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Brett Shumaker

    (@brettshumaker)

    Hi @bcpen

    Do you have a link to where this is happening?

    Your [staff_loop] has an unclosed a tag around the [staff-bio] template tag so that might be causing unintended results depending on your theme. Please add the </a> after [staff-bio] and see if that helps resolve your display issue.

    Thanks!

    Thread Starter bcpen

    (@bcpen)

    Thank Brett!

    You are right (fixed it). What my question should have read is. How can you only show the bio link if the bio field is filled.

    the link is https://www.nelsontennisclub.com/contact/

    Thanks again,bc

    updated code:

    [staff_loop]
    <a href="/staff-members/[staff-name-slug]">
    <img class="staff-member-photo" src="[staff-photo-url]" alt="[staff-name] : [staff-position]"></a>
        <div class="staff-member-info-wrap">
            [staff-name]</a><br>
            [staff-position] <br>     [staff-email-link]  [staff-phone]
           <br><a href="/staff-members/[staff-name-slug]">Bio</a>      
        </div>
    [/staff_loop]
    Plugin Author Brett Shumaker

    (@brettshumaker)

    Hi @bcpen

    How can you only show the bio link if the bio field is filled.

    Unfortunately, there’s not a way to do this in the staff loop template.

    There might be an “unstable” (as in it might break with a future update) way to achieve this, though, and it may not be the best approach depending on how the staff member content is updated. But if only one person is updating content, and they know that this “technique” is in place, you could use one of the staff fields you’re not using – which appear to be facebook and twitter. You could change your Bio link to this in your staff loop template:

    
    <a href="/staff-members/[staff-name-slug]" data-has-bio="[staff-facebook]">Bio</a>
    

    Then, in a staff member who doesn’t have a Bio, you can set their facebook to no. Then, with CSS you could do this to hide the link if that value is no:

    
    a[data-has-bio="no"] {
        display: none;
    }
    

    Again, that might not work depending on how the site content will be edited and there’s always a chance that it could break with a future update of the plugin (I’m not planning anything that would break that, but I suppose it could happen at some point).

    Hope that helps.

    Thanks!

    Thread Starter bcpen

    (@bcpen)

    Thanks Brett that is a cool sollution!
    bc

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