Amazon Context-Links werden von YouTube Videos überdeckt
10. Januar 2009Ich hatte diese Woche ein kleines Problem mit den Amazon Context-Links, diese wurden dauernd von den YouTube Videos überdeckt, so dass die Amazon Context-Links nicht mehr wirklich zu erkennen waren.
Hier habe ich natürlich mal wieder eine kleine Lösung für euch parat.
In dem Code der YouTube Videos findet ihr immer folgenden embed-Tag:
<embed src="http://www.youtube.com/..." type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="295"></embed>
Wenn Ihr diesen wie folgt ändert ist das Problem mit den Amazon Context-Links gelöst:
<param name="wmode" value="transparent"></param><embed wmode="transparent" src="http://www.youtube.com/..." type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="295"></embed>
Das im Code unterstrichene bitte eurem Code hinzufügen.
Für diejenigen die WordPress als Blog-Software nutzen habe ich auch einen kleinen Hack der dieses Problem automatisiert aus dem Weg schafft.
Öffne die Datei “post-template.php” im “/wp-inculdes/” Verzeichnis und suche nach folgender Funktion:
function the_content($more_link_text = '(more...)', $stripteaser = 0, $more_file = '') {
$content = get_the_content($more_link_text, $stripteaser, $more_file);
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
echo $content;
}
und ersetzte diese Funktion durch folgenden Code:
function flash2background($string) {
$string = str_replace('<embed', '<param name="wmode" value="transparent"></param><embed wmode="transparent" ', $string);
return $string;
}
function the_content($more_link_text = '(more...)', $stripteaser = 0, $more_file = '') {
$content = get_the_content($more_link_text, $stripteaser, $more_file);
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
$content = flash2background($content);
echo $content;
}
Ab sofort wird in jedem Blog-Beitrag der sämtlicher Flash-Code so manipuliert das eure YouTube-Videos hinter den Amazon Context-Links liegt.
So das war es schon. Und nicht vergessen vorher die Datei “/wp-includes/post-template.php” zu sichern damit Ihr euch nichts kaputt macht.


Danke für den super Tipp!