Support » Fixing WordPress » Plugin not loading usings enqueue script to load 2 jquery files with dependency

  • Hi,
    I am trying to configure a plugin. It is cycle2 slides that has two files jquery.cycle2.min.js and jquery.cycle2.carousel.min.js. There is dependency on cycle2 for carousel to work. Here is my code for enqueueing the scripts in my child’s theme functions.php file. I can’t see the plugin code when I do a view source in the browser.

    function my_scripts_method() {
        $template_dir = get_stylesheet_directory_uri();
        if ( is_front_page() ){
            wp_enqueue_script( 'cycle2', $template_dir . '/js/jquery.cycle2.min.js',array( 'jquery' ) );
            wp_enqueue_script( 'cycle2-carousel', $template_dir . '/js/jquery.cycle2.carousel.min.js', array( 'jquery', 'cycle2' ) );
        }
    }
    add_action( 'wp_enqueue_scripts', 'my_scripts_method' );

    Thanks for your help. Margaret

  • The topic ‘Plugin not loading usings enqueue script to load 2 jquery files with dependency’ is closed to new replies.