Hallo zusammen,
ich bastle gerade an einem Plugin "Google ID Change", damit lassen sich für unterschiedliche Autoren deren Google ID in die Adsense Anzeige einbauen. Eigentlich funktioniert es auhc schon, aber irgendwie bekomme ich noch seltsame Fehler manchmal. Hier erstmal der Code des Plugin:
function display_google_id($content) {
$current_post_title = $content;
$abfrage = mysql_query("SELECT * FROM wp_posts WHERE post_title ='$current_post_title'");
$row = mysql_fetch_object($abfrage);
$author_id = $row->post_author;
$abfrage = mysql_query("SELECT * FROM wp_users WHERE ID ='$author_id'");
$row = mysql_fetch_object($abfrage);
echo $row->google_adsense_id;
}
Vorher müssen natürlich ein paar Daten in der Usertabelle hinzugefügt werden.
Das Plugin nutze ich dann so (Beispiel Adsense Code mit Plugin-Aufruf):
<script type="text/javascript"><!--
google_ad_client = "<?php display_google_id(single_post_title('', FALSE)); ?>";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text";
google_ad_channel ="4101537590";
google_color_border = "f8f8f8";
google_color_bg = "f8f8f8";
google_color_link = "B28601";
google_color_url = "B28601";
google_color_text = "000000";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
Alles anzeigen
Wenn ich dann das Plugin aktiviere, erhalte ich folgende Warnhinweise im Backend:
Zitat
Warning: Cannot modify header information - headers already sent by (output started at /www/htdocs/w005a960/webdesignblog/wp-content/plugins/google_id_change.php:65) in /www/htdocs/w005a960/webdesignblog/wp-admin/admin.php on line 10Warning: Cannot modify header information - headers already sent by (output started at /www/htdocs/w005a960/webdesignblog/wp-content/plugins/google_id_change.php:65) in /www/htdocs/w005a960/webdesignblog/wp-admin/admin.php on line 11
Warning: Cannot modify header information - headers already sent by (output started at /www/htdocs/w005a960/webdesignblog/wp-content/plugins/google_id_change.php:65) in /www/htdocs/w005a960/webdesignblog/wp-admin/admin.php on line 12
Warning: Cannot modify header information - headers already sent by (output started at /www/htdocs/w005a960/webdesignblog/wp-content/plugins/google_id_change.php:65) in /www/htdocs/w005a960/webdesignblog/wp-admin/admin.php on line 13
Kann mich jemand unterstützen? Ertaste gerade erst die große tolle Welt der Wordpress Plugin Programmierung.
Gruß Chris