Will man nebenstehenden Amazon Affiliate-Link in einen WordPress-Beitrag einbinden, erfordert der Code von Amazon die Verwendung des IFRAME-Tags. Leider führt das Einbinden des IFRAMEs in einen WordPress-Beitrag durch die standardmäßigen HTML-Korrekturen von TinyMCE nicht zur erwünschten Darstellung des Amazon-Links. In der Plugin-Sammlung von wordpress.org wird man zwar bestimmt fündig, aber es geht viel einfacher:
Man durchforstet den verwendeten Theme-Ordner ( in wp-content / themes / mein-thema-xxx) nach der Datei functions.php. Am Ende der „functions.php“ fügt man nun folgenden Quellcode ein. Sollte diese Datei functions.php nicht vorhanden sein, legt man diese Datei neu an und ergänzt den untenstehenden Quellcode mit den PHP-Auszeichnungen „ <?php … (Quellcode) …?> “.
/*** Verwendung des Tags <iframe> (für Amazon PartnerNet) in Beiträgen ermöglichen **/ function erlaube_iframe($initArray) { $initArray['extended_valid_elements'] = "iframe[id|class|title|style|align|frameborder|height|longdesc|marginheight|marginwidth|name|scrolling|src|width]"; return $initArray; } add_filter('tiny_mce_before_init', 'erlaube_iframe');
Nun steht einer Karriere als Großverdiener mit Amazon-PartnerNet – Links nichts mehr im Wege
.
Thank you very much for this solution! I had been looking for a solution to the Amazon iframe code problem for a long time. This worked for me.
Thank you as well for your nice answer.
Nice Greetings from the cold and snowy Linz (Austria)
Michael Punzenberger
Thanks,
just started using Amazon yesterday and was trying to figure out why I couldn’t make the detailed links show up in a row. This worked like a charm.
Thanks a million! I kept having to re-enter the code every time I clicked the Visual tab in Wordpress. This will save me a lot of time.
Would this work for any iframe, such as Google Calendar? I will be turning a website over to a client and they will use the WYSIWYG editor, so I need the iframes to not be deleted when switching back and forth between the ‘Visual’ and ‘HTML’ editors.I inserted the above code, but it didn’t work for the Google Calendar iframe. Is ‘erlaube’ actually what the code calls for, because I can’t find that as a PHP function. I translated it as ‘permit’, but that doesn’t work either.Thanks for your help! -Mark
Hi Mark,
the function’s name “erlaube_iframe” is no standard function, it only refers to the last parameter of the statement “add_filter” in the last line of my published source code. This code just prevents the iframe-tag not to be eliminated by the TinyMCE-Editor in WordPress. Therefore it should work with any code between the iframe-tags.
The source code has to be inserted in the functions.php of the activated theme. Or, it also can be inserted in the functions.php of the folder “wp-includes”. But then you have to reinsert the code with every update of WordPress.
I never checked the Google Calendar on my websites, so maybe you first try another website in an iframe. Maybe Google prevents the display of the calendar in an iframe by JavaScript.
Hope you still can solve the problem, nice greetings from Linz
Michael Punzenberger