Putting it all together: Edit the theme or create a custom plugin?
We've learned in this chapter how easy it is to edit a theme, create a WordPress plugin, and a jQuery plugin. For the majority of your WordPress development work, adding jQuery enhancements right to the theme will do the trick. If you feel your jQuery scripts are a bit cumbersome and you're allowed to edit the theme (assuming of course, you don't break the layout or dramatically alter the look) you'll probably find that being able to wrap WordPress content in custom HTML tags with special class
or id
attributes is a huge help and time saver.
This chapter's project example's "hypothetical client request" also showed that if there's any chance that your work can or will be reused or deployed across multiple individual WordPress installations, you should consider encapsulating the work in either a jQuery plugin, a WordPress plugin, or as we discovered, both.
In addition to considering if your work will need to be reused or...