{"id":9306,"date":"2016-04-21T03:30:03","date_gmt":"2016-04-21T03:30:03","guid":{"rendered":"http:\/\/2slick.com\/web\/?p=9306"},"modified":"2016-04-21T03:30:03","modified_gmt":"2016-04-21T03:30:03","slug":"add-jquery-script-to-wordpress","status":"publish","type":"post","link":"https:\/\/2slick.com\/web\/add-jquery-script-to-wordpress\/affordablewebsitestips\/tutorials","title":{"rendered":"Add jQuery script to WordPress"},"content":{"rendered":"<p>jQuery is built into WordPress and you can add a jQuery script to your self hosted WordPress website using the built in wp_enqueue_script() function.<\/p>\n<ol>\n<li>Create a simple jQuery js file and call it 'test.js'.<br \/>\n<a href=\"http:\/\/2slick.com\/web\/wp-content\/uploads\/2016\/04\/wp_enqueue_script.jpg\"><img loading=\"lazy\" decoding=\"async\" style=\"border: 1px solid black;\" title=\"wp_enqueue_script\" src=\"http:\/\/2slick.com\/web\/wp-content\/uploads\/2016\/04\/wp_enqueue_script.jpg\" alt=\"\" width=\"315\" height=\"181\" \/><\/a><\/li>\n<li>Save the js file in your WordPress, theme's 'js' folder on your server.<\/li>\n<li>Modify the 'functions.php' file in the root directory of your WordPress website to include this line of code:&nbsp;wp_enqueue_script( 'test', get_template_directory_uri() . '\/assets\/javascripts\/test.js', array(), '1.0.0', true);<\/li>\n<\/ol>\n<p>Test refresh your website and the alert popup should appear.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>jQuery is built into WordPress and you can add a jQuery script to your self hosted WordPress website using the built in wp_enqueue_script() function. Create a simple jQuery js file and call it &#8216;test.js&#8217;. Save the js file in your WordPress, theme&#8217;s &#8216;js&#8217; folder on your server. Modify the &#8216;functions.php&#8217; file in the root directory [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,6],"tags":[],"class_list":["post-9306","post","type-post","status-publish","format-standard","hentry","category-tutorials","category-wordpress"],"_links":{"self":[{"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/posts\/9306","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/comments?post=9306"}],"version-history":[{"count":2,"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/posts\/9306\/revisions"}],"predecessor-version":[{"id":9309,"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/posts\/9306\/revisions\/9309"}],"wp:attachment":[{"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/media?parent=9306"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/categories?post=9306"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/tags?post=9306"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}