WordPress.org

Ready to get started?Download WordPress

Forums

Can I put an iframe on a WP page? (7 posts)

  1. Ken Soszka
    Member
    Posted 5 years ago #

    Hi, I have an iframe that I am trying to add to a new page, using the html section in the page editor. When I switch to visual view or preview, the code disappears. Is it not possible?

    Thanks in advance!

  2. asechrest
    Member
    Posted 5 years ago #

    I believe WordPress sanitizes your input and automatically kills <iframe>, among other things.

    You could use a custom page template for the page you're creating and then code the iframe into the template. Or hard-code it into page.php and use an is_page() conditional to have it show up only on the new page you created.

  3. webjunk
    Member
    Posted 5 years ago #

    Will work in visual view as well. But yes you might find the code dissapears when you switch back again to html view. I have done iFrames many times on different sites. Just don't play too much. Trick is save a copy of your code in a text editor (just in case) while you are making new changes and do not switch back and for to visual view.
    You only need something basic for iFrames like:

    <iframe src ="http://webjunk.com" width="100%" height="300">
    <p>Your browser sucks. It won't work with iframes.</p>
    </iframe>

  4. Shane G
    Member
    Posted 5 years ago #

    Hi,

    You can embed it with the help of plugins..please check this...

    http://wordpress.org/extend/plugins/embed-iframe/

    Thanks,

    Shane G.

  5. ClaytonJames
    Member
    Posted 5 years ago #

    When I switch to visual view or preview, the code disappears.

    Place your iframe wherever you need it in the page. No plugin required. Do not switch between the html and visual editor while doing so. Place your iframe via html, and publish the page. Check the result and adjust if required.

  6. asechrest
    Member
    Posted 5 years ago #

    I stand corrected, then. Spent too much time lately learning about WP filtering, now I think everything's filtered. ;-)

  7. Janne Bowtell
    Member
    Posted 5 years ago #

    You can do it so that when you switch from html to visual the iframe is still there, I have done this with the assistance of the plugin Max Banner Ads Pro on my website, you create a zone in widgets, then in options for that zone you tick single post/page. Then you add banner and the iframe text is copied into the Other Text Ads/Flash/Javascript (Adsense, Adbrite etc...) box and saved, then under the actions for that banner copy the post tag into your html editor wherever you want it on the page and will look something like this <!--MBA:Banner=7--> in the html when you switch to visual you see nothing but when you swith back, bingo it is still there. this saves yo from having to re copy the Iframe into to your page everytime you edit that page. :-)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags