Last active
June 6, 2019 14:44
-
-
Save heyitsritesh/edb187182f516c3f3cc7893a2bc3b7b9 to your computer and use it in GitHub Desktop.
Display AdSense Auto Ads Only On Specific Pages In WordPress | https://www.digitalkube.com/adsense-auto-ads-on-specific-pages-wordpress/
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
//*** Auto Ads on Single Posts ***// | |
add_action( 'wp_head', 'digitalkube_add_tracking_code' ); | |
function digitalkube_add_tracking_code() { | |
if (is_single()) { | |
?> | |
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> | |
<script> | |
(adsbygoogle = window.adsbygoogle || []).push({ | |
google_ad_client: "ca-pub-xxxxxxxxxxxxxxx", | |
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