Amazon associates and WordPress

22.08.15. The text below is obsolete now as WordPress now supports iframe directly.

Sometimes I write about books and I have applied for Amazon associates to advertize these books. The use of the links from Amazon associates happened to be problematic though. They produce them as iframe and WordPress does not like iframe. When I copy the code to the HTML editor and then go back to the visual editor, the iframe code dissapears.

Quick solution is just to use the HTML editor and not to switch to the visual editor at all. This works but I like comfort and did not want to loose the opportunity to use the visual editor. Then I have searched for plugins and finally I have found Insere Iframe

http://blog.idealmind.com.br/wordpress/insereiframe-a-simple-wordpress-plugin-to-insert-iframe-in-posts/

With this plugin installed it is necessary to modify the link from Amazon in the HTML editor, for example

<iframe src="AmazonLink" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>

as follows

[iframe: src="AmazonLink" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"]

Then plugin will transform it to the normal code on the fly. You will see however this code in the Visual Editor, not what will be shown in the blog. I have found useful to add float:left;margin-right:10px;margin-bottom:10px; to the style.


Comments are closed.