简体   繁体   中英

Why is my wp_enqueue_scripts not firing

Here is my code and it is not firing. I can directly link the css and get it to show but using the wp_enqueue_script does nothing.

Here is what I have coded.

<?php function load_slider(){
  wp_deregister_script( 'jquery' ); // deregisters the default WordPress jQuery  
  wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"), false);

  wp_enqueue_script('jquery');
  wp_register_script('flexslider', get_stylesheet_directory_uri() .'/javascripts/jquery.flexslider-min.js', array( 'jquery' ), 'v2.20', true);

  wp_register_style('flexstyle', get_template_directory_uri() .'stylesheets/flexslider.css', "", 'v2.2.0', true);       
}

wp_enqueue_script('flexslider');
wp_enqueue_style('flexstyle');

add_action( 'wp_enqueue_scripts', 'load_slider' );

?>

none of this shows in the browser so I know it is not being found.

function load_slider(){
    wp_deregister_script( 'jquery' ); // deregisters the default WordPress jQuery  
    wp_register_script('custom-jquery', "http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js", false);

    wp_enqueue_script('custom-jquery');
    wp_register_script('flexslider', get_stylesheet_directory_uri() .'/javascripts/jquery.flexslider-min.js', array( 'custom-jquery' ), 'v2.20', true);

    wp_register_style('flexstyle', get_template_directory_uri() .'stylesheets/flexslider.css', "", 'v2.2.0', true);
    wp_enqueue_script('flexslider');
    wp_enqueue_style('flexstyle');       
}



add_action( 'wp_enqueue_scripts', 'load_slider' );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM