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.
Well, now what?
Work with Me
I'm available for hire and always taking new clients, big and small. Got a project or an idea you'd like to discuss? Startup plan but no developer to make it happen? Just get in touch, I'd love to see if I can help you out!
Leave some Feedback
Got a question or some updated information releavant to this post? Please, leave a comment! The comments are a great way to get help, I read them all and reply to nearly every comment. Let's talk. 😀
One thought on “WordPress and Prototype”
Thanks Tyler, I wasn’t aware of that either.