-1
如何將YouTube嵌入到Buddy Press用戶配置文件的自定義字段中?如何在自定義字段中嵌入youtube好友按
如何將YouTube嵌入到Buddy Press用戶配置文件的自定義字段中?如何在自定義字段中嵌入youtube好友按
請參考以下鏈接,希望這會幫助你,
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');
這工作,謝謝! –
我添加了代碼,因爲鏈接將來可能會過期。 –