So, adsense was a breeze to be added in the content. on the left side by adding custom css and the code in functions.php what i did is below. Based on a post by Flynn.
Below is the code added to Custom css and html inserts in Atahualpa options.
Code:
div.bfa-adsense { float: left; display: block; margin: 0em 10px 5px 0; /* margin 0em top, 0px right, 5px bottom, 0 left */ }
Code:
function bfa_add_adsense($post_body_content) { $adsense_ad = '<div class="bfa-adsense"> <script type="text/javascript"><!-- google_ad_client = "pub-123456789043783284782"; /* 336x280, created 2/24/10 */ google_ad_slot = "74539475983"; google_ad_width = 336; google_ad_height = 280; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> </div>'; if ( is_single() ) { if (strpos($post_body_content,'%adsense%')!==FALSE) { $post_body_content = str_replace('%adsense%', $adsense_ad, $post_body_content); } else { $post_body_content = $adsense_ad . $post_body_content; } } return $post_body_content; } add_filter('the_content', 'bfa_add_adsense');
But when i tried the same thing with adbrite code..... The page goes blank....nothing comes up.
As you know that google allows only 3 adsense units on one page..... so only the first three posts would have the add.... this is the reason i want to use adbrite.... and instead of displaying the add on the single posts i want it to be displayed on homepage, search results, categories, tag pages, and other places where multiple posts are displayed. I tried bidvertiser code in home page and IT WORKED. Only adbrite is not working.
for bidvertiser i used
Code:
if ( is_home() ) {
Code:
if ( is_single() ) {
but when i do the code below for adbrite, the homepage comes blank. Please I really need your help in regard to this problem. I am using Atahualpa 343.
so below is the code that i put in functions.php and the page come blank.
Code:
add_filter('the_content', 'bfa_add_adsense'); function bfa_add_adsense1($post_body_content) { $adsense_ad = '<div class="bfa-adsense1"> <!-- Begin: AdBrite, Generated: 2010-03-30 18:13:21 --> <script type="text/javascript"> var AdBrite_Title_Color = '000000'; var AdBrite_Text_Color = '000000'; var AdBrite_Background_Color = 'FFFFFF'; var AdBrite_Border_Color = 'CCCCCC'; var AdBrite_URL_Color = '000000'; try{var AdBrite_Iframe=window.top!=window.self?2:1;var AdBrite_Referrer=document.referrer==''?document.location:document.referrer;AdBrite_Referrer=encodeURIComponent(AdBrite_Referrer);}catch(e){var AdBrite_Iframe='';var AdBrite_Referrer='';} </script> <script type="text/javascript">document.write(String.fromCharCode(61,83,67,22,73,80,83));document.write(' src="http://ads.adbrite.com/mb/text_group.php?sid=34237489273&zs=46236486238&ifr='+AdBrite_Iframe+'&ref='+AdBrite_Referrer+'" type="text/javascript">');document.write(String.fromCharCode(60,27,83,66,82,79,80,84,68));</script> <div><a target="_top" href="http://www.adbrite.com/mb/commerce/purchase_form.php?opid=34733829&afsid=1" style="font-weight:bold;font-family:Arial;font-size:13px;">Your Ad Here</a></div> <!-- End: AdBrite --> </div>'; if ( is_home() ) { if (strpos($post_body_content,'%adsense%')!==FALSE) { $post_body_content = str_replace('%adsense%', $adsense_ad, $post_body_content); } else { $post_body_content = $adsense_ad . $post_body_content; } } return $post_body_content; } add_filter('the_content', 'bfa_add_adsense1');
Code:
div.bfa-adsense1 { float: left; display: block; margin: 0em 10px 5px 0; /* margin 0em top, 0px right, 5px bottom, 0 left */ }
Also, please advise what would i use instead of
Code:
if ( is_home() ) {
Code:
if ( is_single() ) {
Thank you all in advance.
Jack.