Skip to content

Instantly share code, notes, and snippets.

@thegulshankumar
Created May 8, 2017 04:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thegulshankumar/8e4680deb8716d26a863560a3e438c0e to your computer and use it in GitHub Desktop.
Save thegulshankumar/8e4680deb8716d26a863560a3e438c0e to your computer and use it in GitHub Desktop.
function first_amp_ad() {
return '<amp-ad
layout="fixed-height"
height=100
type="adsense"
type="amp_ad"
data-ad-client="ca-pub-xxxxxxxxxxxxxx"
data-ad-slot="xxxxxxxxx">
</amp-ad>';
}
add_shortcode('amp_ad_1', 'first_amp_ad');
@thegulshankumar
Copy link
Author

thegulshankumar commented Aug 21, 2017

Instruction

  1. Install 'Code Snippets' plugin.
  2. Add new snippet to create a AMP ad unit shortcode
  3. To show Ad unit in the AMP page, paste [amp_ad_1] in your post editor. Don't forget to update publisher and Ad slot ID.
    That's all.

Need any help? Tweet @TheGulshanKumar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment