{"id":22,"date":"2008-08-03T20:25:32","date_gmt":"2008-08-04T02:25:32","guid":{"rendered":"http:\/\/bililite.nfshost.com\/blog\/index.php\/2008\/08\/03\/a-jquery-wordpress-plugin\/"},"modified":"2008-08-05T20:03:26","modified_gmt":"2008-08-06T02:03:26","slug":"a-jquery-wordpress-plugin","status":"publish","type":"post","link":"https:\/\/bililite.com\/blog\/2008\/08\/03\/a-jquery-wordpress-plugin\/","title":{"rendered":"A jQuery WordPress plugin"},"content":{"rendered":"<p>The <a href=\"http:\/\/codex.wordpress.org\/Using_Javascript\">Using Javascript<\/a> page in the Codex says to include\r\ncommon javascript files in your <code>header.php<\/code> file, but that means re-writing it whenever you change themes. I created a simple plugin that includes jQuery and ui.jquery on each page; it's<\/p>\r\n<pre>\r\n&lt;?php\r\n\/*\r\nPlugin Name: jQuery\r\nPlugin URI: http:\/\/bililite.nfshost.com\/blog\/\r\nDescription: Includes the jQuery javascript framework (and the ui.jquery plugins) in your page, with some styling for &lt;pre&gt; elements\r\nAuthor: Daniel Wachsstock\r\nVersion: 1.0\r\nAuthor URI: http:\/\/bililite.nfshost.com\/blog\/\r\n*\/ \r\n\r\nfunction jQuery(){\r\necho '\r\n   &lt;script type=&quot;text\/javascript&quot; src=&quot;http:\/\/www.google.com\/jsapi?key=apikey&quot;&gt;&lt;\/script&gt;\r\n   &lt;script type=&quot;text\/javascript&quot;&gt;google.load(&quot;jquery&quot;,&quot;1&quot;);&lt;\/script&gt;\r\n   &lt;script type=&quot;text\/javascript&quot; src=&quot;http:\/\/ui.jquery.com\/js\/ui.js&quot; &gt;&lt;\/script&gt;\r\n   &lt;style&gt;\r\n      pre {\r\n        background: #F4F4F4;\r\n        border: 1px solid #B2B2B2;\r\n        overflow: scroll;\r\n      }\r\n    &lt;\/style&gt;';\r\n}\r\n\r\nadd_action('wp_head', 'jQuery');\r\n\r\n?&gt;\r\n\r\n<\/pre>\r\n\r\n<p>Replace <code>apikey<\/code> with <a href=\"http:\/\/code.google.com\/apis\/ajaxsearch\/signup.html\">your own Google API key<\/a>.","protected":false},"excerpt":{"rendered":"The Using Javascript page in the Codex says to include common javascript files in your header.php file, but that means re-writing it whenever you change themes. I created a simple plugin that includes jQuery and ui.jquery on each page; it's &lt;?php \/* Plugin Name: jQuery Plugin URI: http:\/\/bililite.nfshost.com\/blog\/ Description: Includes the jQuery javascript framework (and [&hellip;]","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,20],"tags":[],"_links":{"self":[{"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/posts\/22"}],"collection":[{"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/comments?post=22"}],"version-history":[{"count":1,"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/posts\/22\/revisions"}],"predecessor-version":[{"id":34,"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/posts\/22\/revisions\/34"}],"wp:attachment":[{"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/media?parent=22"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/categories?post=22"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/tags?post=22"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}