Custom Fields
Re-Envisioned
Support MB User Meta User's Social Media Links

  • Creator
    Topic
  • #24047
    Resolved Rebecca Robertson
    Participant

    I'm sure this has already been addressed somewhere and is more than likely just me being a bit dense, so I apologize in advance.

    I have created public user profiles for my authors that are basically author boxes. The profiles include links to the author's social media accounts.

    This is an example of how I am calling the links:
    <a href="<?php echo $user->facebook; ?>" target="_blank" class="sl-item fa fa-facebook"></a>

    The problem I'm running into is that the icons for the links show up even if the user hasn't added their account for a particular social media platform.

    I'm fairly certain that I need to be calling the fields in some other manner, I'm just not sure how.

    Any help would be appreciated.

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #24050
    Long Nguyen
    Moderator

    Hi,

    You can check if the data is not empty then show the link

    if( !empty( $user->facebook ) ) {
        <a href="<?php echo $user->facebook; ?>" target="_blank" class="sl-item fa fa-facebook"></a>
    ...
    }
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.