Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 23rd May 2010, 09:25 PM   #1
New Warrior Member
War Room Member
 
Join Date: 2007
Location: Arizona USA
Posts: 24
Thanks: 86
Thanked 1 Time in 1 Post
Blog Entries: 1
Default
php code help for wp revenue sharing
Share on: 
fb share twitter share gplus share more share

I have a revenue sharing site that up until recently was using a plugin to display adsense for each author by channels... this is taking me forever to add the code for a new author and I'm trying to make this easier for myself by only having to add code once on author sign up. So here's what I've done so far to no avail..

I added this to my mu.functions.php file to associate the author with a particular channel in adsense using the "ad slot" number.

function adsense_sharing($author) {
if($author == 'admin')
return 'xxxxx';
elseif ($author == 'xxxx')
return 'xxxxx';
elseif ($author == 'xxx')
return 'xxxxx';
else
return 'xxxxx';
}
?>

with the "xxx" being the author name and google ad slot #

then.. I added this to my single.php

<div style="float:right;"><script type="text/javascript"><!--
google_ad_client = "pub-xxxxx";
/* Snurtl */
google_ad_slot = “<?php echo adsense_sharing(get_the_author());?>”;
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>

ok.. so if i view the source it shows the ad code fine.. just like it's supposed to be..It's showing the correct ad slot # for the author.. but the ad doesn't show, just a blank space so I obviously am missing a space or comma or something. when I copy the code directly into the template from adsense obviously it works fine...

No my domain is not blacklisted or banned.

solved: funky quotes in “<?php echo adsense_sharing(get_the_author());?>”;
Sarah Harris is offline  
Unread 29th May 2010, 11:27 PM   #2
WP & PHP Expert...
War Room Member
 
newmoon's Avatar
 
Join Date: 2010
Posts: 34
Thanks: 3
Thanked 2 Times in 2 Posts
Default
Re: php code help for wp revenue sharing
Share on: 
fb share twitter share gplus share more share

I guess ad slot ads will not be displayed this way. ads slots are registered to specific adsense publisher. you have to put old ads code and replace the pub code.

Code:
<script type="text/javascript">
google_ad_client = "ca-pub-xxxxx";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text_image";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "3C6080";
google_color_text = "000000";
google_color_url = "3C6080";
</script>

newmoon is offline  
Closed Thread


Bookmarks

Tags
code, php, revenue, sharing


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 03:55 AM.