User's Social Media Links

Support MB User Meta User's Social Media LinksResolved

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #24047
    Rebecca RobertsonRebecca 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.

    #24050
    Long NguyenLong 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 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.