JavaScript files are not registered
-
I am converting an HTML page to a WordPress theme for a customer, and everything was going fine until I got to the JavaScript part.
I can get the css files to work just fine by using
wp_register_style('header', get_template_directory_uri() . '/css/header.css', array(), 1, 'all'); wp_enqueue_style('header');
I have tried to add the JS files, but for some reason they are not registered when I test the page. What have I missed?
function shapeSpace_include_custom_jquery() { wp_deregister_script('jquery'); wp_enqueue_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js', array(), null, true); } add_action('wp_enqueue_scripts', 'shapeSpace_include_custom_jquery'); function load_javascript() { wp_register_script('script2', get_template_directory_uri() . '/js/script2.js', array(), 1, 1, 1); wp_enqueue_script('script2'); wp_register_script('script3', get_template_directory_uri() . '/js/script3.js', array(), 1, 1, 1); wp_enqueue_script('script3'); wp_register_script('navigation', get_template_directory_uri() . '/js/navigation_script.js', array(), 1, 1, 1); wp_enqueue_script('navigation'); wp_register_script('scroll', get_template_directory_uri() . '/js/scroll.js', array(), 1, 1, 1); wp_enqueue_script('scroll'); }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘JavaScript files are not registered’ is closed to new replies.