2013-03-17 52 views
0

進出口使用下面的代碼在functions.php中調整我IFRAMES的iFrame自動調整在WordPress的

function add_youtube_size($youtubehtml) { 
    if (strpos($youtubehtml, "<iframe") !== false) { 
     $youtubesearch = array('width="460"', 'height="310"'); 
     $youtubereplace = array('width="600"', 'height="338"'); 
     $youtubehtml = str_replace($youtubesearch, $youtubereplace, $youtubehtml); 

     return $youtubehtml; 
    } else { 
     return $youtubehtml; 
    } 
} 
add_filter('the_content', 'add_youtube_size', 10); 

但這個代碼只編輯I幀的460 X 310

有任何方式的大小我可以更改該行$youtube search = array('width="460"', 'height="310"');以獲得任何可能的大小?

回答

0

是的,你可以改變它

$youtubesearch = array('width="460"', 'height="310"'); 
$youtubereplace = array('width="600"', 'height="338"'); 

在這些線路同時改變寬度高度到你所需要的,但重要的是你搜索的視頻也應該在你寫的寬度和高度

可用