Tag: JavaScript

JavaScript the WordPress Way / Part 1

Problems arise when your theme or plugin both use the same JavaScript library or if Prototype and jQuery are both used on the same site.

Two of the most important WordPress functions are often ignored by WordPress theme and plugin developers. Introducing: wp_register_script and wp_enqueue_script.

Code

Partying like it’s 1999

Within a couple of months of writing that I prefered my own base JavaScript file to an exisiting framework, I was a convert to jQuery. Why the turnaround?

Code

Including WordPress’s comment-reply.js (the right way)

Since threaded comments were enabled in Wordpress 2.7, most themes check if the visitor is browsing either a page or a post and adds the JavaScript required for threaded comments if they are.

I prefer a slight variation

Code

JavaScript Equal Height Columns

The desire for equal height columns in a CSS layout is nothing new; there are many solutions available, some use JavaScript, others use CSS with negative margins, and then, there’s the faux columns method using background images. All of these methods have their place as perfectly valid solutions, and, depending on the situation, may be the best solution available.

Code

Base JavaScript File

Upcoming posts on JavaScript will include references to functions in my base JavaScript file; rather than explain these functions each time, they?ll be detailed in this post for future reference.

Code