-2

I am trying to create a wordpress theme from scratch, but when adding

add_action('wp_enqueue_scripts', 'jquery');

to have my js script alert pop up on the page I get

Parse error: syntax error, unexpected '', 1, true); ' (T_CONSTANT_ENCAPSED_STRING), expecting ')'

for that line

function include_jquery() {
  wp_deregister_script('jquery');
  wp_enqueue_script('jquery', get_template_directory_uri() . '/js/jquery3.3.1.min.js, '', 1, true);
  add_action('wp_enqueue_scripts', 'jquery');
}
add_action('wp_enqueue_scripts', 'include_jquery');

I expected the code to bring up my alert from my js file.

$(document).ready(function() {  
  alert('test');
})
Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
  • You have a missing `'` after the jquery.min.js string. I'd strongly suggest using a IDE with syntax highlighting as it makes typos like this almost impossible to miss. – Rory McCrossan Feb 17 '19 at 13:02
  • yup, use an IDE or just setup your text editor with a linter plugin, it'll help you to prevent a typo – metaphor Feb 17 '19 at 13:04
  • thanks, will do guess I'm tired I found other 3 basic mistakes, might as well be a blind man trying to code lol – Andre Romero Feb 17 '19 at 13:15

1 Answers1

0

Typo. Change

wp_enqueue_script('jquery', get_template_directory_uri() . '/js/jquery3.3.1.min.js, '', 1, true);

to

wp_enqueue_script('jquery', get_template_directory_uri() . '/js/jquery3.3.1.min.js', '', 1, true);
Mitya
  • 33,629
  • 9
  • 60
  • 107