Viewing 9 replies - 1 through 9 (of 9 total)
  • If you must insert it in the editor, disable the visual editor in Users > Your Profile before putting it in there.

    Although a better way would be to turn the iframe into a shortcode so you could keep using the editor. A shortcode is a simple bracketed phrase that WordPress will replace with actual code when rendered.

    So if you put [my-iframe] in your visual editor, you could go to your functions.php and type this (make sure to back it up and be able to access it via FTP. If you make any mistakes your site will be inaccessible).

    add_shortcode('my-iframe', 'my_iframe_shortcode');
    function my_iframe_shortcode() { ?>
    <iframe code goes here>
    <?php }
    Thread Starter William Bowles

    (@creative-i)

    Hi Billerickson:
    Ok, but what about for example when I use Vodpod? Vodpod sends the code automatically to my site, it’s not something I create.

    Re modifying functions.php: Does it matter where it gets inserted?

    Bill

    I’m not sure how Vodpod works, how does it automatically generate posts? As long as you (or Vodpod) don’t use the visual editor on a post that has code in it you should be fine.

    I’ve clicked on a few links in Vodpod and it looks like they’re hosting Youtube videos. If you could somehow have Youtube video URLs inserted rather than embed codes everything would work great. WordPress will automatically convert a youtube url into the embed code, so it won’t mess with your visual editor.

    It doesn’t really matter where your code goes in functions.php, but I’d suggest putting it at the very bottom, but before the ?> if that’s present in your file.

    Thread Starter William Bowles

    (@creative-i)

    Basically, what vodpod does is generate a link from whatever source I select, usually from the Bookmarklet I’ve installed in Firefox, so it pulls whatever code is in the source, whether object or iframe and posts it to the WP editor. VP doesn’t host the video, just a link to it.

    If it’s iframe I either paste in the object code (if I can get it) or I sometimes use a plugin eg [youtube]xxx…[/youtube] or whatever.

    What I want to know is why does WP strip out the iframe code, especially as youtube and others seem to switching to iframe?

    And I’ll check the functions.php

    Thanks

    Bill

    The visual editor isn’t meant for html code (like iframes), it’s meant for written content.

    You don’t need to use a plugin for youtube shortcode ([youtube]xxx[/youtube]), that’s a built-in feature of WordPress. Go to General > Media and make sure auto-embed is checked. That will automatically convert http://www.youtube.com/xxxx to the embed code.

    More information here: http://codex.wordpress.org/Embeds

    Thread Starter William Bowles

    (@creative-i)

    Yeah, I keep hearing this, but it’s such ass-backwards way of doing things. Surely I should be able to switch back and forth between visual and source, like I do in Dreamweaver for example or am I asking too much from the WP editor?

    Re the youtube insert, ok if it’s youtube but I often post vids from other sources which is why I sometimes use a plugin or embed or object code.

    And why does the Editor accept embed and object code but not iframe?

    B

    Thread Starter William Bowles

    (@creative-i)

    Thanks!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘iframe code deleted’ is closed to new replies.