Amazon and the iFrame… a solution!

Another Wordpress post here. We recently added some Amazon affiliate product links on another site we have, and decided to include some Amazon dynamic ads as well. Both use the HTML <iFrame> tag, which is considered bad form these days as it doesn’t follow strict HTML standards. As such, the TinyMCE editor used in Wordpress refuses to validate that tag and strips them from posts. This is awkward, as Amazon delivers its product and ad HTML using an iframe.

There are several WP plugins which allow insertion of products using shortcodes (thus bypassing the editor), but I couldn’t find anything viable which allows the same functionality with ads. For a while I thought I found a slick workaround here but it was a false alarm. It worked in my test (WAMP) site, but broke the visual editor in a production Linux environment. After more searching I finally found this plugin which exactly met my needs. It allows you to specify the element (iframe) and the attributes (id, class, title, style, align, frameborder, height, longdesc, marginheight, marginwidth, name, scrolling, src and width, if you’re interested), which then causes TinyMCE to consider iframe a valid element. I’m praying that a future upgrade of Wordpress or the editor doesn’t break this plugin or I’ll have to start this goat rope all over again.

And this is why I love Wordpress… for just about anything you want to do, someone out there has already done it and posted a solution. All you need to do is find it… this one only took me about 6 hours.

4 Responses to “Amazon and the iFrame… a solution!”

Leave a Reply

Current Poll

I'm here because...

View Results

Loading ... Loading ...