php - Blocking google adsense code in theme: Why isn't this working? -


i've added header.php in wordpress...

<?php // block google adsense on these post id's?>     <?php global $ad_flg; $ad_flg=1; ?>     <?php $adsense_blck_post = array(7130, 7151); ?>      <?php if (in_array($post->id,$adsense_blck_post,true)) $ad_flg=0; ?> <?php // stop blocking google adsense on these post id's?> 

then, block individual ad spots, i've implemented code around ad code.

global $ad_flag; if($ad_flag!=0) {    echo td_global_blocks::get_instance('td_block_ad_box')->render(array('spot_id' => 'post_style_12'));  

}

however, when add in example, it's not working. can tell me i'm doing wrong?

        //add top ad     global $ad_flag; if (td_util::is_ad_spot_enabled('content_top') , is_single() , $ad_flag!=0) {         $content = td_global_blocks::get_instance('td_block_ad_box')->render(array('spot_id' => 'content_top')) . $content;     } 

you're setting variable called $ad_flg , checking 1 called $adsense_flag. try using same name in both places.


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -