Created
April 9, 2020 10:51
-
-
Save wpgaurav/2faad0cdb324272b8b461e6f72ead12f to your computer and use it in GitHub Desktop.
Add Google Auto Ads to posts only
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
<?php add_action('wp_head', 'google_ads'); | |
function google_ads() { | |
if (is_singular('post')){ | |
echo '<script data-ad-client="ca-pub-1495783196891276" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>'; | |
} | |
// Change data-ad-client="ca-pub-1495783196891276" with your data-ad-client | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment