Skip to:
Content
Pages
Categories
Search
Top
Bottom

Social media fields as icons (not working)


  • a608237
    Participant

    @a608237

    I’ve been trying to follow examples to show social media fields as a linked icon for some time (including examples in this forum) and it just hasn’t been happening, and I dont know why.

    For example, with facebook:

    $fb_page = xprofile_get_field_data(‘Facebook’, $UserID);

    if($fb_page) { ?>
    < a href=”http:facebook.com/”<? php echo $fb_page ? >/” target=”_blank” title=”Facebook”>HI</ a> <? php
    }

    This code was just to test if I could even just hyperlink text to facebook.com. But it is not working. Instead, the following is output on the front:

    myFacebook.Field/” target=”_blank” title=”Facebook”>HI

    What is going wrong?

    Wordpress:5.1.1
    Buddypress: 4.2
    theme: twentyseventeen

Viewing 1 replies (of 1 total)

  • shanebp
    Moderator

    @shanebp

    Please use the code button when sharing code.

    You didn’t provide any context for where you are making the call to xprofile_get_field_data.
    Is it in a function? If so, what is that function hooked to?

    Are you aware that there are 3 parameters ?
    xprofile_get_field_data( $field, $user_id = 0, $multi_format = 'array' );

    So perhaps your issue is related to the return of an array.
    Try: $fb_page = xprofile_get_field_data('Facebook', $UserID, 'comma' );

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar