WordPress and Prototype

Lots of people have searching about wordpress and prototype.js and have been lading at my post about Alex King’s Share This plugin and prototype.js. At the time I made that post, I wasn’t aware of the wp_enueque_script() function in WordPress 2.1.

Making use of wp_enqueue_script will ensure that your script is only loaded once. It’s really handy, hopefully everyone that uses prototype in their theme or plugin will start using wp_enqueue_script to load the prototype.js file. To load prototype, you’d use wp_enqueue_script like so:

<?php wp_enqueue_script('prototype'); ?>

Prototype isn’t the only script that can be loaded with wp_enqueue_script. Take a look in wp-includes/script-loader.php to see some of the other scripts that wp_enqueue_script can load by default.

Popularity: 9% [?]

1 Response to “WordPress and Prototype”


  1. 1 Dean

    Thanks Tyler, I wasn’t aware of that either.

Leave a Reply

Quicktags:

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/web site in attribution.



cheap xbox 360 games - buy from zavvi
cheap xbox 360 games - zavvi

No Teletrack Payday Loans - mobile phones - Web Design - Cheap Electricity - Renegade motorhomes - Mobile Phones - Credit Cards
Search Engine Optimisation - Mobile Phone - Bike Insurance - Landlords Insurance - Search Engine Marketing - Mobile Phone