Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter giilour

    (@giilour)

    got it working with this code

    add_filter( ‘bxcft_show_field_value’, ‘my_show_field’, 15, 4);
    function my_show_field($value_to_return, $type, $id, $value) {
    if ($type == ‘web’) {
    $value = str_replace(“<p>”, “”, $value);
    $value = str_replace(“</p>”, “”, $value);
    $field = new BP_XProfile_Field($id);
    if ($field->name == ‘Link test youtube’) {
    $link_src = strip_tags(trim($value));
    $link_src = str_replace(‘youtu.be/’, ‘youtube.com/embed/’, $link_src);
    return ‘<iframe width=”560″ height=”315″ src=”‘.$link_src.'” frameborder=”0″ allowfullscreen></iframe>’;
    }
    }
    return $value_to_return;
    }

    change the ‘Link test youtube’ to the field that you have in your xprofile.

    the field type is website(html5)

    @giilour

    To me its showing a blank area only. Can you please help me?

    Screen shot – https://imgur.com/a/WI0xb

    Thank you

    Thread Starter giilour

    (@giilour)

    are you using the youtu.be link as the input in the field?
    make sure the field type in xprofile is website(html5)
    and change the
    if ($field->name == ‘Link test youtube’)

    to if ($field->name == ‘Whatever the name of the xprofile field is called’)

    Awesome! This works with youtu.be short URL.

    Thank you!

    johnhorning-1

    (@johnhorning-1)

    FYI, I had trouble with the quotation marks. This worked for me:
    https://codeshare.io/aVZ1yz

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘youtube embed in xprofile fields’ is closed to new replies.