douyong5825
2015-01-22 01:12
浏览 69
已采纳

在Wordpress中更改Vimeo / Youtube默认大小

How to change Vimeo/Youtube embed sizes?

Currently the default embed is very small 300x150, i need 540px minimum :(

Using snippet to filter in functions.php, the code no works.

function rezzz_embed_defaults($defaults) {
    $defaults['width'] = 350;
    $defaults['height'] = 200;

    return $defaults;
}

add_filter('embed_defaults','rezzz_embed_defaults');

Please see screenshot -> http://i.imgur.com/kv8SPEA.png

图片转代码服务由CSDN问答提供 功能建议

如何更改Vimeo / Youtube嵌入大小?

目前默认嵌入 是非常小的300x150,我需要540px最小:(

使用片段在functions.php中过滤,代码无效。

   function rezzz_embed_defaults($ defaults){
 $ defaults ['width'] = 350; 
 $ defaults ['height'] = 200; 
 
返回$ defaults; 
} 
 
add_filter('embed_defaults'  ,'rezzz_embed_defaults'); 
   
 
 

请看截图 - > http://i.imgur.com/kv8SPEA.png

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douya6229 2015-01-22 11:38
    已采纳


    Please see your code carefully. I have used your code but changed width and height.

    function rezzz_embed_defaults($defaults) {
        $defaults['width'] = 540;
        $defaults['height'] = 304;
    
        return $defaults;
    }
    
    add_filter('embed_defaults','rezzz_embed_defaults');
    

    You need to provide width and height in proper ratio to use video from youtube, vimeo and other source.

    You can see working demo of above code here

    点赞 打赏 评论

相关推荐 更多相似问题