Support Forum

enable iframe?

DK Dan Kleiman
Dan Kleiman
Member

Hi,

 

Is there any way to enable iframe for embedding? I understand the security concerns, but on my membership site right now, it seems to be the only way I can share embedded video with iPad/iPhone users….

 

Any suggestions for how to get them video?

 

Thanks,
Dan

9 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

iFrames are under constant discussion but there is an enormous security concern over their use.

Have you tried using the oEmbed method? Where you just paste the actual url into the post and turn on the oEmbed support in WordPress (settings > media panel).

BR Brandon
Brandon
Member

Most all of the new browsers support HTML5 video before trying to open up iframes you may want to give that a try.

Using the TinyMCE embed media icon you can open it up and add a video. Select HTML5 video and enter the filename.

Depending on what type of videos you are sharing mp4,ogg this may be a solution.

Simple:Press also works with WordPress’s Oembed feature http://codex.wordpress.org/Embeds you may want to look at that also.

MP Mr Papa
Mr Papa
Member

or if you really want to take the security risk (eek) we can tell you how to use a filter to change the allowed html…

JK jkswopes
jkswopes
Member

I’m looking for an answer to this question as well, I have a private membership so I’m not concerned with the security issues, how do we use the filters to enable this option?

YS Yellow Swordfish
Yellow Swordfish
Member

OK – this is untested as I am doing it quickly but I think this should do the trick.

Open up the spFunctions.php file in the SP theme templates folder and add this code:

add_filter('sph_custom_kses', 'my_function');
function my_function($allowedforumtags) {
    $allowedforumtags['iframe'] = array('class' => array(), 'style' => array(), 'height' => array(), 'width' => array(). 'src' => array(), 'scrolling' => array());
    return $allowedforumtags;
}

Of course – you should supply your own function name to replace ‘my_function’.

As always we recommend that you create your own SP theme so that any customisation is not lost during a future update. (http://codex.simple-press.com/codex/themes/theme-basics/creating-a-theme/)

JK jkswopes
jkswopes
Member

By “my function” does that mean whatever name I want or am I looking for a certain function in my existing template code?  

YS Yellow Swordfish
Yellow Swordfish
Member

Sorry not clear – you can call it whatever you like. Even ‘my_function’ if you wish. 🙂

But is usually better to come up with something unique – like putting your initials in front of it. No spaces of course. Note there are two instances of the function name to change – they must be the same.