Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@johnregan3
Last active September 28, 2016 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save johnregan3/84df6666467744e6159efdc8524bc0ab to your computer and use it in GitHub Desktop.
Save johnregan3/84df6666467744e6159efdc8524bc0ab to your computer and use it in GitHub Desktop.
Add component scripts to WP AMP
<?php
/**
* Register the amp-sidebar and amp-accordion component scripts with WP AMP.
*
* This goes in your amp.php
*/
function jr3_amp_component_scripts( $data ) {
$data['amp_component_scripts']['amp-sidebar'] = 'https://cdn.ampproject.org/v0/amp-sidebar-0.1.js';
$data['amp_component_scripts']['amp-accordion'] = 'https://cdn.ampproject.org/v0/amp-accordion-0.1.js';
return $data;
}
add_filter( 'amp_post_template_data', 'jr3_amp_component_scripts' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment