Home Forums ASE Support Full width Iframe Reply To: Full width Iframe

#14782

Hyun Supul

Keymaster

Hi Andy, here is a solution. Paste this code to the end of functions.php under the theme (Novella in this case) folder. And then iframes across the site can be made full width.


function filter_ptags_on_iframe($content)
{
    return preg_replace('/<p>\s*(<iframe .*>*.<\/iframe>)\s*<\/p>/iU', '\1', $content);
}
add_filter('the_content', 'filter_ptags_on_iframe');

When you insert an iframe from the editor, leave a single empty line in front of the iframe and after. And set the width to 100% as usual. You can set height param to whatever you need.

Now the issue is if you change or update the theme functions.php would be overwritten. So it’s recommended to inject that php code using a plugin instead (such as “Custom CSS-JS-PHP” plugin) Let me know if you need a help on this. Thank you.

  • This reply was modified 4 years ago by Hyun Supul.
  • This reply was modified 4 years ago by Hyun Supul.
  • This reply was modified 4 years ago by Hyun Supul.
  • This reply was modified 4 years ago by Hyun Supul.
  • This reply was modified 4 years ago by Hyun Supul.