Archive slider for CPT

I have a custom post type and archive page. I want to be able to use the default twentyfourteen theme slider so that the archive-cpt.php page calls the js and displays a slider only for the CPT. I imagine I call a function, but I don’t know how to write the script or how to call it from. I know the js location of the slider. Any help here would be really appreciated.

Solutions Collecting From Web of "Archive slider for CPT"

The slider script is called with the following lines of code

if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) {
    wp_enqueue_script( 'twentyfourteen-slider', get_template_directory_uri() . '/js/slider.js', array( 'jquery' ), '20131205', true );
    wp_localize_script( 'twentyfourteen-slider', 'featuredSliderDefaults', array(
        'prevText' => __( 'Previous', 'twentyfourteen' ),
        'nextText' => __( 'Next', 'twentyfourteen' )
    ) );
}

You just need to copy these lines and add them in your child theme and change your condition accordingly. The following in your child theme should work. Note: I believe here that you leave the js files in the parent theme

add_action( 'wp_enqueue_scripts', 'enqueue_slider_scripts', 11 );
function enqueue_slider_scripts()
{
    if (     is_post_type_archive( 'cpt' ) // Change 'cpt' your match your exact cpt 
         && 'slider' == get_theme_mod( 'featured_content_layout' ) 
    ) {
        wp_enqueue_script( 'twentyfourteen-slider', get_template_directory_uri() . '/js/slider.js', array( 'jquery' ), '20131205', true );
        wp_localize_script( 'twentyfourteen-slider', 'featuredSliderDefaults', array(
            'prevText' => __( 'Previous', 'twentyfourteen' ),
            'nextText' => __( 'Next', 'twentyfourteen' )
        ) );
    }
}

EDIT

Just remember to copy the following lines to your archive page to display your slider

<?php                
    if ( twentyfourteen_has_featured_posts() )               
        get_template_part( 'featured-content' );        
?>