Home Forums ACF PRO Linking social media icons to blog author page


Linking social media icons to blog author page

  • Hi, i’ve created social media fields for my blog authors so that they can show as icons on their author pages. I can get the images to show on the page and the links do get pulled to the page from the user profile – i did that by using DIVI dynamic content on the links. That works fine. However, if the user does not include a social link on their profile (eg they have Facebook and Insta but not Twitter), the Twitter icon still shows on the author page and i can’t find a way to hide it.

    I started out with the icons and it didn’t work so then thought to try with code and then add the icons in later using CSS. I tried using this (taken from the ACF get values from a user page) and modified it but i don’t think i got it right. And i’m not sure if i’m even putting it in the right place or if i need to add anything to function.php page (complete techy newbie here!)

    $author_id = get_the_author_meta('ID');
    $dt_facebook_url = get_field('dt_facebook_url', 'user_'. $author_id );
      <a href="<?php echo $dt_facebook_url['url']; ?>" alt="facebook>" />Test</a></p>

    Ideally i’d prefer to go with the first option (as the icons are already working mostly) but if anyone has any suggestions, i’d appreciate it. Images attached showing the fields etc.


  • For anyone interested, i managed an easy css fix that required none of the above.

    this to the style sheet:

    .et_pb_social_media_follow .icon[href=””] {
    display: none;

  • Hi dpeople!

    I am trying to achieving the exact same thing. I have created the ACF fields for the users.
    I have tried your CSS code but it does not work for me. It stills showing social icons even if there is no URL.

    Is there anything more I could do?

  • Sorry #iciaretxebarria, Iā€™m on holiday atm and have no computer to look. Good luck with it!

  • Hi dpeople!
    Enjoy your holidays!
    I have just found how to make it work for me šŸ™‚ If anyone needs it. Just add an “#” in the attribute selector šŸ™‚

    .et_pb_social_media_follow .icon[href=”#”]{
    display: none;

    Have a nice day!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.