如何在自定义字段 buddypress 中嵌入 youtube
How to embed youtube in custom field buddy press
如何将 YouTube 嵌入 Buddy Press 用户个人资料的自定义字段中?
参考下文link,希望对您有所帮助,
http://snippetbarn.bp-fr.net/how-to-embed-a-video-on-profile/
function set_video_field( $field_value ) {
$bp_this_field_name = bp_get_the_profile_field_name();
// field name (case sensitive)
if( $bp_this_field_name == 'Spotlight' ) {
$field_value = strip_tags( $field_value );
// building the HTML and h/w of the iframe
$field_value = '<iframe width="420" height="315" src="http://www.youtube.com/embed/'.$field_value.'" frameborder="0" allowfullscreen></iframe>';
}
return $field_value;
}
add_filter( 'bp_get_the_profile_field_value','set_video_field');
如何将 YouTube 嵌入 Buddy Press 用户个人资料的自定义字段中?
参考下文link,希望对您有所帮助,
http://snippetbarn.bp-fr.net/how-to-embed-a-video-on-profile/
function set_video_field( $field_value ) {
$bp_this_field_name = bp_get_the_profile_field_name();
// field name (case sensitive)
if( $bp_this_field_name == 'Spotlight' ) {
$field_value = strip_tags( $field_value );
// building the HTML and h/w of the iframe
$field_value = '<iframe width="420" height="315" src="http://www.youtube.com/embed/'.$field_value.'" frameborder="0" allowfullscreen></iframe>';
}
return $field_value;
}
add_filter( 'bp_get_the_profile_field_value','set_video_field');