Title: enqueuing amp js components scripts
Last modified: March 17, 2018

---

# enqueuing amp js components scripts

 *  Resolved [designerj](https://wordpress.org/support/users/designerj/)
 * (@designerj)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/enqueuing-amp-js-components-scripts/)
 * If I want to use some amp js components, how can I add them to amp_component_scripts
   array? I assume I can load an array of component names in here somehow with a
   filter/action? Is that where I need to add my extra scripts or have I misunderstood?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [designerj](https://wordpress.org/support/users/designerj/)
 * (@designerj)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/enqueuing-amp-js-components-scripts/#post-10085360)
 * nevermind I figured it out myself, hope this is the correct way?
 *     ```
           add_action('amp_post_template_data', 'xyz_amp_component_scripts');
   
           function xyz_amp_component_scripts( $data ) {
           	$data['amp_component_scripts']['amp-carousel'] = 'https://cdn.ampproject.org/v0/amp-carousel-0.1.js';
           	return $data;
           }
       ```
   
 *  [Ryan Kienstra](https://wordpress.org/support/users/ryankienstra/)
 * (@ryankienstra)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/enqueuing-amp-js-components-scripts/#post-10143492)
 * **Your Snipped Is Correct**
 * Hi [@designerj](https://wordpress.org/support/users/designerj/),
    Thanks, the
   snippet you posted above is the correct way to add a component script. You might
   also use this URL, as it’ll be the latest version:
 * [https://cdn.ampproject.org/v0/amp-carousel-latest.js](https://cdn.ampproject.org/v0/amp-carousel-latest.js)
 * Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘enqueuing amp js components scripts’ is closed to new replies.

 * ![](https://ps.w.org/amp/assets/icon.svg?rev=2527602)
 * [AMP](https://wordpress.org/plugins/amp/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/amp/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/amp/)
 * [Active Topics](https://wordpress.org/support/plugin/amp/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/amp/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/amp/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Ryan Kienstra](https://wordpress.org/support/users/ryankienstra/)
 * Last activity: [8 years, 2 months ago](https://wordpress.org/support/topic/enqueuing-amp-js-components-scripts/#post-10143492)
 * Status: resolved