How to fix this warning about ‘amp-ad extension .js script’?
-
When I use the AMP validator at https://validator.ampproject.org I get only one warning, but I’m unclear how it is being generated and how to fix it. This is the warning I get:
The tag ‘amp-ad extension .js script’ is missing or incorrect, but required by ‘amp-ad’. This will soon be an error.
The code it is probably referencing is in my functions.php and looks like this:
/** * Include Google Ads with AMP. This is placed in the theme functions file */ add_action( 'amp_post_template_footer', 'xyz_amp_add_advertisement' ); function xyz_amp_add_advertisement( $amp_template ) { $post_id = $amp_template->get( 'post_id' ); ?> <?php { //GOOGLE AD GOES HERE printf(' <div class="amp-wp-content"><amp-ad width=auto height=200 type="adsense" data-ad-client="ca-pub-MYNUMBERHERE" data-ad-slot="ADSLOTNUMBERHERE"> </amp-ad></div>'); } ?> <?php }
Any idea how to to fix this ‘amp-ad extension .js script’ warning?
Thank you
Viewing 13 replies - 1 through 13 (of 13 total)
Viewing 13 replies - 1 through 13 (of 13 total)
- The topic ‘How to fix this warning about ‘amp-ad extension .js script’?’ is closed to new replies.