Last active
December 22, 2015 15:49
-
-
Save idavinder/6495516 to your computer and use it in GitHub Desktop.
Disable Adsense on specific posts in WordPress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//add this to header.php file, also change 82959, 82960 post ids or add more in the code | |
//http://www.basicwp.com/block-adsense-ads-on-specific-posts/ | |
<?php Global $ad_flg; $ad_flg=1; ?> | |
<?php $adsense_blck_post = array(82959, 82960); ?> | |
<?php if (in_array($post->ID,$adsense_blck_post,true)) $ad_flg=0; ?> | |
//add this on single.php where adsense ad is displayed | |
<?php Global $ad_flg; if($ad_flg!=0) { ?> | |
You adsense code here | |
<?php } ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment