wp_enqueue_script not working in custom theme

I am trying to enqueue a js file from my theme’s functions.php file (calculator.js).

I have a desktop theme and a smartphone theme, and I am using a plugin to switch between the two themes depending on the user’s device.

I have the exact same code on my desktop theme and it works perfectly, however when I copied it to my smartphone theme, it just seems to ignore the enqueue script.

Here is my code:

function wpb_adding_scripts() {
wp_register_script(‘calculator_script’, get_template_directory_uri() . ‘/js/calculator.js’, array( ‘jquery’ ), NULL, ‘all’);
wp_enqueue_style( ‘slider’, get_template_directory_uri() . ‘/css/calculator.css’,false,’1.1′,’all’);
add_action( ‘wp_enqueue_scripts’, ‘wpb_adding_scripts’ );

I have made sure that my functions.php file does indeed start with a opening php tag, all files are in their correct directories, and the console is not flagging any errors. Any insights as to what might be the cause of this issue?

Thank you very much.

Read more here:: wp_enqueue_script not working in custom theme

Leave a Reply

Your email address will not be published. Required fields are marked *