So, habe die Lösung jetzt auch noch in einem anderen Blog getestet - es funktioniert. Nur ist die Funktion the_content() in den neuren WP-Versionen jetzt nicht mehr in der template-functions-post.php, sondern in der post-template.php zu finden.
Will man nun z.B. immer nach dem ersten Zeilenumbruch im Artikel
automatisiert einen (und auch nur einen!) AdSense-Block eingefügt haben, so muss die Funktion von ihrem Ursprungszustand
Code
function the_content($more_link_text = null, $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;
}
z.B. wie folgt angepasst werden:
Code
function the_content($more_link_text = null, $stripteaser = 0, $more_file = '') {
$content = get_the_content($more_link_text, $stripteaser, $more_file);
$content = apply_filters('the_content', $content);
if (!is_home()) {
// --- Integration der Adsense-Anzeige
$blocks = explode('<br />',$content);
$blocks[0] .= '<p><center><script type="text/javascript"><!--
google_ad_client = "pub-12345678987654321";
google_ad_slot = "123456789";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript" src="[URL]http://pagead2.googlesyndication.com/pagead/show_ads.js[/URL]">
</script></center>';
$content = join('<br />',$blocks);
}
$content = str_replace(']]>', ']]>', $content);
echo $content;
}
Alles anzeigen
Hope that helps ... :)