1

So I found this tool that automatically resizes an iframe from an html page:

http://consumer.easyxdm.net/current/example/resize_iframe.html

But when I follow their examples it won't work within WordPress.

Does anyone know how to make it work or have an alternative method that works with an iframe embedded within WordPress?

Kyoku
  • 182
  • 1
  • 4
  • 13
  • I found an amazing solution that works perfectly. http://stackoverflow.com/questions/153152/resizing-an-iframe-based-on-content – Kyoku Nov 25 '11 at 04:13
  • Ended up using this solution: http://stackoverflow.com/questions/153152/resizing-an-iframe-based-on-content – Kyoku Nov 25 '11 at 17:14
  • Did you include the easyXDM.js? I'm using easyXDM as part of a WordPress plugin and it seems to be working fine. – colllin Aug 09 '12 at 18:18

1 Answers1

0

add this to functions.php it will find every iframe with width = 560 and Height = 315 and change it to width = 600 and height = 338

    function add_youtube_size($youtubehtml) {
   if (strpos($youtubehtml, "<iframe" ) !== false) {
        $youtubesearch = array( 'width="560"', 'height="315"');
        $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);
Luisfm
  • 1
  • 2