[theme-reviewers] Bundling libraries and prefixing

Otto otto at ottodestruct.com
Thu Feb 27 17:13:03 UTC 2014

On Thu, Feb 27, 2014 at 8:32 AM, Konstantin Kovshenin
<kovshenin at gmail.com> wrote:
> Quick question.
> If a theme bundled the Twitter Bootstrap library, or Nivo Slider, or
> jQuery Colorbox, should it prefix the wp_enqueue_script/style handles
> with the theme name, or should it use a generic name?
> wp_enqueue_script( 'nivo-slider', ... );
> vs
> wp enqueue_script( 'themename-nivo-slider', ... );
> Thanks!

The first one.

Prefixing is intended to provide separation. However, the ID in this
case is intended to make sure that the script is only loaded once. If
both the theme and a plugin used the same name for the same script,
then the script would still load once, properly.

The handle of the script should be based on the name of the script. If
it's custom to the theme, then prefix it. If it's a generic script
that comes from elsewhere, then choose the most obvious handle for it.


More information about the theme-reviewers mailing list