我正在尝试向vimeo视频添加参数,这些参数是通过Wordpress的oembed嵌入的。我已经设法用下面的代码为youtube视频做到了这一点。我在functions.php中使用了这个函数,它的效果非常好。我已经为Vimeo视频编辑了同样的代码,但我似乎不能让它工作。
这是我的代码:
function Oembed_vimeo_no_title($html,$url,$args){
// Only run this for vimeo embeds
if ( !strstr($url, 'vimeo.com') )
return $html;
$url_string = parse_url($url, PHP_URL_QUERY);
parse_str($url_string, $id);
if (isset($id['v'])) {
return '<div id="video_full_width"><iframe width="100%" height="394" src="//player.vimeo.com/video/'.$id['v'].'?title=0&byline=0&portrait=0" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen ></iframe></div>';
}
return $html;
}
add_filter('oembed_result','Oembed_vimeo_no_title',10,3);
对我做错了什么有什么建议吗?
https://stackoverflow.com/questions/24395204
复制相似问题