{"id":920,"date":"2014-01-16T21:00:50","date_gmt":"2014-01-16T21:00:50","guid":{"rendered":"http:\/\/www.sitecompany.com\/word\/?p=920"},"modified":"2014-01-16T21:02:39","modified_gmt":"2014-01-16T21:02:39","slug":"use-jquery-prefix-instead-of-for-wordpress","status":"publish","type":"post","link":"https:\/\/www.sitecompany.com\/word\/use-jquery-prefix-instead-of-for-wordpress\/","title":{"rendered":"Use jQuery prefix instead of $ for wordpress"},"content":{"rendered":"<p>Recently I was testing a jQuery code snippet to see if it would \u00a0accomplish what I needed it to accomplish. The easiest way to do this was to simply paste the jQuery code into the <strong>header.php<\/strong> file.<\/p>\n<p>I was frustrated to find this didn&#8217;t work. My search for a solutions yielded little but a bunch of stuff about <strong>wp_enque_script.\u00a0<\/strong>I just wanted to see if this code would fit my need not spend my entire afternoon reading up on &#8220;the proper way to do it&#8221;.<\/p>\n<p>&nbsp;<\/p>\n<h2>The quick and dirty<\/h2>\n<p>Long story short. The solution was to simply replace every instance of &#8220;$&#8221; in code with &#8220;jQuery&#8221;. \u00a0That done the code snippet pasted to the header.php worked \u00a0fine and I was able to confirm that it would suit my needs.<\/p>\n<h2>Not a production solution<\/h2>\n<p>Its important to note that this is not production solution but a &#8220;test&#8221; solution. In fact when you read up on wp_enque_script \u00a0you will find that their is a way to let wordpress do automatically the replacement that I did manually. But if you are in a jam and just want to test a simple piece of code this might be just what you were looking for. But be forewarned that <strong>wp_enque_script<\/strong> exists to avoid conflict and you will have just bypassed that entire system. \u00a0So use this only for quick tests before deciding whether or not to go through all the trouble of actually using <strong>wp_enque_script<\/strong>.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently I was testing a jQuery code snippet to see if it would \u00a0accomplish what I needed it to accomplish. The easiest way to do this was to simply paste the jQuery code into the header.php file. I was frustrated to find this didn&#8217;t work. My search for a solutions yielded little but a bunch [&hellip;]<\/p>\n","protected":false},"author":11,"featured_media":706,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[62,11],"tags":[],"class_list":["post-920","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-programming","category-wordpress-help"],"_links":{"self":[{"href":"https:\/\/www.sitecompany.com\/word\/wp-json\/wp\/v2\/posts\/920","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sitecompany.com\/word\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sitecompany.com\/word\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sitecompany.com\/word\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sitecompany.com\/word\/wp-json\/wp\/v2\/comments?post=920"}],"version-history":[{"count":0,"href":"https:\/\/www.sitecompany.com\/word\/wp-json\/wp\/v2\/posts\/920\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sitecompany.com\/word\/wp-json\/wp\/v2\/media\/706"}],"wp:attachment":[{"href":"https:\/\/www.sitecompany.com\/word\/wp-json\/wp\/v2\/media?parent=920"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sitecompany.com\/word\/wp-json\/wp\/v2\/categories?post=920"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sitecompany.com\/word\/wp-json\/wp\/v2\/tags?post=920"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}