Last active
March 16, 2018 08:20
-
-
Save braddalton/e1bf8da5b4465ebeccf3db29ed4395c7 to your computer and use it in GitHub Desktop.
Adsense Auto Ads in Genesis - Conditionally Remove From Posts in Specific Category https://wp.me/p1lTu0-hoH
This file contains 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_action( 'wp_head', 'adsense_auto_ads' ); | |
function adsense_auto_ads() { | |
if ( ! is_singular(array( 'post','page' ) ) ) { | |
return; | |
} | |
if ( in_category( 'sponsored' ) ) { | |
return; | |
} | |
?> | |
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> | |
<script> | |
(adsbygoogle = window.adsbygoogle || []).push({ | |
google_ad_client: "ca-pub-xxxxxxxxxxxxx", | |
enable_page_level_ads: true | |
}); | |
</script> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment