• Resolved designerj

    (@designerj)


    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

    (@designerj)

    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;
        }

    Your Snipped Is Correct

    Hi @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

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘enqueuing amp js components scripts’ is closed to new replies.