Problem with JavaScripts addition in WordPress

Question

I am transferring boostrap theme to WordPress and trying to add JavaScript files in functions.php and execution shows no error:

<?php
function regload_javascripts() //need to register first
{
   wp_register_script('bootstrapjs',  get_template_directory_uri().'/js/bootstrap.js',array('jquery'),'1.1', true);
   wp_enqueue_script('bootstrapjs');
   wp_register_script('carousel',  get_template_directory_uri().'/js/carousel.js',array('jquery'),'1.1', true);
   wp_enqueue_script('carousel');
   wp_register_script('custom',  get_template_directory_uri().'/js/custom.js',array('jquery'),'1.1', true);
   wp_enqueue_script('custom');
   wp_register_script('flexslider',  get_template_directory_uri().'/js/flexslider.js',array('jquery'),'1.1', true);
   wp_enqueue_script('flexslider');
   wp_register_script('jquery182',  get_template_directory_uri().'/js/jquery-1.8.2.js',array('jquery'),'1.1', true);
   wp_enqueue_script('jquery182');
   wp_register_script('cslider',  get_template_directory_uri().'/js/jquery.cslider.js',array('jquery'),'1.1', true);
   wp_enqueue_script('cslider');
   wp_register_script('gmap_min', get_template_directory_uri().'/js/jquery.gmap.min.js',array('jquery'),'1.1', true);
   wp_enqueue_script('gmap_min');
   wp_register_script('slider',  get_template_directory_uri().'/js/slider.js',array('jquery'),'1.1', true);
   wp_enqueue_script('slider');
}

add_action ('wp_enqueue_scripts', 'regload_javascripts');

But there is no effect.

The js files are here:
js files

My dev console output is :

TypeError: $ is undefined carousel.js:3:6079    <anonymous> http://localhost/wordpress/wp-content/themes/bootgotya/js/carousel.js?ver=1:3
TypeError: $ is not a function flexslider.js:14:2     <anonymous> http://localhost/wordpress/wp-content/themes/bootgotya/js/flexslider.js?ver=1:14 
Loading failed for the <script> with source “http://localhost/wordpress/js/flexslider.js”. wordpress:590:1 
Loading failed for the <script> with source “http://localhost/wordpress/js/carousel.js”. wordpress:591:1 
Loading failed for the <script> with source “http://localhost/wordpress/js/jquery.cslider.js”. wordpress:592:1
0
Bex 3 years 2020-04-05T16:50:57-05:00 0 Answers 71 views 0

Leave an answer

Browse
Browse