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
<?php /* Plugin Name: jQuery Plugin URI: http://bililite.nfshost.com/blog/ Description: Includes the jQuery javascript framework (and the ui.jquery plugins) in your page, with some styling for <pre> elements Author: Daniel Wachsstock Version: 1.0 Author URI: http://bililite.nfshost.com/blog/ */ function jQuery(){ echo ' <script type="text/javascript" src="http://www.google.com/jsapi?key=apikey"></script> <script type="text/javascript">google.load("jquery","1");</script> <script type="text/javascript" src="http://ui.jquery.com/js/ui.js" ></script> <style> pre { background: #F4F4F4; border: 1px solid #B2B2B2; overflow: scroll; } </style>'; } add_action('wp_head', 'jQuery'); ?>
Replace apikey
with your own Google API key.
Leave a Reply