Title: Theme Frameworks and Namespacing Guidelines
Author: Chip Bennett
Published: March 14, 2012
Last modified: March 16, 2012

---

 [  ](https://profiles.wordpress.org/chipbennett/) [Chip Bennett](https://profiles.wordpress.org/chipbennett/)
7:56 pm _on_ March 14, 2012     
Tags: Frameworks, [Guidelines ( 34 )](https://make.wordpress.org/themes/tags/guidelines/),
Namespacing   

# Theme Frameworks and Namespacing Guidelines

Due to confusion – mostly caused by inconsistent nomenclature – regarding namespacing
requirements for Theme frameworks, we would like to clarify the guidelines, and 
open the floor to discussion.

First, a word on nomenclature. For the purposes of this discussion, and the guidelines,
a “Theme framework” is not a stand-alone Theme, but rather a “drop-in” code library
used to facilitate Theme development. The following are examples of such Theme frameworks(
note: this list is not an endorsement; rather, it constitutes a quick Google search
for examples only):

 * [Carrington Core](http://carringtontheme.com/category/development/)
 * [Hybrid Core](http://themehybrid.com/hybrid-core)
 * [UpThemes Framework](https://github.com/LiftUX/UpThemes-Framework)
 * [Options Framework](https://github.com/devinsays/options-framework-theme)

Note that none of the above examples constitutes a full, stand-alone Theme. Each
is a library of code, used to develop a Theme. Such code libraries are different
in both nature and purpose from stand-alone Themes that use the term “framework”
to refer to an intended use as a Theme to be forked for further development. (Even
the Codex conflates the uses of the [“Theme framework” terminology](https://codex.wordpress.org/Theme_Frameworks)
in this manner.)

So, to keep the terminology clear, when I refer to “framework”, I mean a _drop-in
code library_, and not a _stand-alone “starter” or “base” Theme_. In other words,
using this definition of “framework”: Hybrid CoreCore Core is the set of software
required to run WordPress. The Core Development Team builds WordPress. is a Theme
framework; the Genesis Theme (even though it is called “Genesis Theme Framework”)
is _not_ a Theme framework, but rather a stand-alone, base/starter Theme.

Now, on to the Guidelines, [which include the following requirement](https://codex.wordpress.org/Theme_Review#Theme_Namespacing):

> Themes are **required** to use a unique slug as a prefix for anything in the public
> namespace, including all custom function names, classes, hooksHooks In WordPress
> theme and development, hooks are functions that can be applied to an action or
> a Filter in WordPress. Actions are functions performed when a certain event occurs
> in WordPress. Filters allow you to modify certain functions. Arguments used to
> hook both filters and actions look the same., public/global variables, database
> entries (Theme options, post custom metadata, etc.)

This guideline applies to forked/derivative Themes. For example, several Twenty 
Ten and Twenty Eleven derivative Themes get submitted to the repository. We require
these Themes to re-namespace their custom functions, hooks, global variables, textdomain,
etc.

However, some confusion arises when a Theme uses a framework – i.e. a drop-in code
library – to develop the Theme. Should the Theme be required to re-namespace the
framework code? Our current thinking is that such a requirement would effectively
defeat the purpose of using a Theme framework, and would deter, rather than facilitate,
Themes using such frameworks – and, more importantly, keeping the framework updated.

Requiring Themes to re-namespace such framework library code would be analogous 
to requiring Themes to re-namespace bundled jQuery PluginPlugin A plugin is a piece
of software containing a group of functions that can be added to a WordPress website.
They can extend functionality or add new features to your WordPress websites. WordPress
plugins are written in the PHP programming language and integrate seamlessly with
WordPress. These can be free in the WordPress.org Plugin Directory [https://wordpress.org/plugins/](https://wordpress.org/plugins/)
or can be cost-based plugin from a third-party. libraries. Also, requiring such 
re-namespacing serves no practical purpose, and would be counter-productive toward
one of the Theme Review Team’s long-term desires to have the means/process/infrastructure
for vetting/approving such Theme frameworks, in order to facilitate their broader
use. If we started requiring Themes to re-namespace the framework library code today,
we’d have a mess on our hands in the future, if we one day are able to have vetted/
approved versions of those same frameworks.

**So, bottom line, TL:DR**: forked/derivative stand-alone Themes ARE required to
re-namespace; Themes that use framework libraries are NOT required to re-namespace
the framework library code.

What are your thoughts?

[#frameworks](https://make.wordpress.org/themes/tags/frameworks/), [#guidelines](https://make.wordpress.org/themes/tags/guidelines/),
[#namespacing](https://make.wordpress.org/themes/tags/namespacing/)

### Share this:

 * [  Threads ](https://make.wordpress.org/themes/2012/03/14/theme-frameworks-and-namespacing-guidelines/?share=threads)
 * [  Mastodon ](https://make.wordpress.org/themes/2012/03/14/theme-frameworks-and-namespacing-guidelines/?share=mastodon)
 * [  Bluesky ](https://make.wordpress.org/themes/2012/03/14/theme-frameworks-and-namespacing-guidelines/?share=bluesky)
 * [  Facebook ](https://make.wordpress.org/themes/2012/03/14/theme-frameworks-and-namespacing-guidelines/?share=facebook)
 * [  X ](https://make.wordpress.org/themes/2012/03/14/theme-frameworks-and-namespacing-guidelines/?share=x)
 * [  LinkedIn ](https://make.wordpress.org/themes/2012/03/14/theme-frameworks-and-namespacing-guidelines/?share=linkedin)

 * [Login to Reply](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fmake.wordpress.org%2Fthemes%2F2012%2F03%2F14%2Ftheme-frameworks-and-namespacing-guidelines%2F%23respond&locale=en_US)

 1.  ![](https://secure.gravatar.com/avatar/a48b3bd7c7fd94650d03fb040a30c174873fa8b6d3bd3f4938a748146f51f49b?
     s=32&d=mm&r=g)
 2.   [ZaMoose](https://profiles.wordpress.org/zamoose/)  1:08 pm _on_ March 15, 2012
 3.  Agree 100%. Kind of wish we would just call so-called “Frameworks” “libraries”
     instead.
 4.  I mean, is [the STL](http://www.sgi.com/tech/stl/) a “framework”?
 5.   * ![](https://secure.gravatar.com/avatar/40a68e4a59a5940fba1f32425af26da08cd699a7c907ba095c30e35898d02c95?
        s=32&d=mm&r=g)
      *  [Edward Caissie](https://profiles.wordpress.org/cais/)  2:06 pm _on_ March
        15, 2012
      * +1; that was the recommendation I was going for in the discussions prior to
        this post. We just have to get used to not using the “framework” buzzword everywhere
        it is currently being applied.
      * ![](https://secure.gravatar.com/avatar/ef868a4b45ef0263f49361744b8bb04e8f3cfcb8f3f79b274fc62823115ee596?
        s=32&d=mm&r=g)
      *  [Justin Tadlock](http://justintadlock.com)  3:23 pm _on_ March 15, 2012
      * We should start calling those other “so-called frameworks” what they really
        are: themes. Everyone who builds a theme with a few hooksHooks In WordPress
        theme and development, hooks are functions that can be applied to an action
        or a Filter in WordPress. Actions are functions performed when a certain event
        occurs in WordPress. Filters allow you to modify certain functions. Arguments
        used to hook both filters and actions look the same. in it is calling it a 
        framework now. Those of us who have had true development frameworks for years
        now (e.g., Hybrid CoreCore Core is the set of software required to run WordPress.
        The Core Development Team builds WordPress., Carrington Core, WP Framework)
        shouldn’t need to start calling them something else because a few companies
        have decided it’s a good word to use for marketing purposes.
         - ![](https://secure.gravatar.com/avatar/a48b3bd7c7fd94650d03fb040a30c174873fa8b6d3bd3f4938a748146f51f49b?
           s=32&d=mm&r=g)
         -  [ZaMoose](https://profiles.wordpress.org/zamoose/)  3:33 pm _on_ March 
           16, 2012
         - Justin:
            No offense intended. Hybrid CoreCore Core is the set of software
           required to run WordPress. The Core Development Team builds WordPress., 
           etc. do indeed hew fairly closely to the compsci definition of “framework”
           with one small exception:
         - Inversion of control
         - In a true framework, the program flow is generally dictated by the framework
           and not the calling program. Perhaps it’s a minor point, but that’s where
           my objection was coming from.
            * ![](https://secure.gravatar.com/avatar/1efc344036f54cbe066a5bf3883426a2ef7c7e457757b38e24465b7be626b1e0?
              s=32&d=mm&r=g)
            *  [scribu](https://profiles.wordpress.org/scribu/)  2:00 am _on_ April
              8, 2012
            * Well, it’s not that clear cut. For example, you can’t really call Carrington
              CoreCore Core is the set of software required to run WordPress. The Core
              Development Team builds WordPress. a “library”. You load it, but then
              it creates the advanced template hierarchy by itself and you can _hook
              into it_ via some filters, if you need to.
 6.  ![](https://secure.gravatar.com/avatar/250257111d1248c34046552bbcdf6999949ef56b2f992dd5eb39bf45cabeb18a?
     s=32&d=mm&r=g)
 7.   [Otto](https://profiles.wordpress.org/otto42/)  4:31 pm _on_ March 15, 2012
 8.  Are you speaking of namespacing in terms of function naming or in terms of internationalization
     calls?
 9.  Function names = don’t care if they re-namespace or not. Doesn’t matter much, 
     since only the active theme is loaded, and having the same functions in multiple
     themes is fine.
 10. Internationalization function calls *must* have their domains be replaced with
     the new domain if there is any such code in the framework that would require it.
     Note that domains need to be plain text strings as well, using defines or global
     variables does not work properly, and never really will for various reasons. However,
     this should be as simple as a global search/replace if the framework is up to 
     par. If the framework is smart about it, all the strings for this could be defined
     in a single file.
 11. ![](https://secure.gravatar.com/avatar/d01d0aa0d7b7deb68832fe9c8565bae3a19464a4dd76e8a0ee675cec3b679758?
     s=32&d=mm&r=g)
 12.  [Sayontan Sinha](https://profiles.wordpress.org/sayontan/)  6:34 pm _on_ March
     15, 2012
 13. What about namespacing of JS libraries? The wp_enqueue_script call provides a 
     handful of JS libraries, but if a theme is using a common JS library like Fancybox
     or JQuery Cycle, what is the requirement? Does the `$handle` argument of wp_enqueue_script
     need to have the theme name prefixed? This can lead to repeated loading of the
     same file on a site.
 14. ![](https://secure.gravatar.com/avatar/a2293936b68aa6f07397754f9d1ae2b771b12ad56f868a980206b8d96f1bad31?
     s=32&d=mm&r=g)
 15.  [Michael Fields](http://wordpress.mfields.org/)  6:49 pm _on_ March 19, 2012
 16. Hello,
 17. The above requirements appear to have been altered before this post was made to
     include “hooksHooks In WordPress theme and development, hooks are functions that
     can be applied to an action or a Filter in WordPress. Actions are functions performed
     when a certain event occurs in WordPress. Filters allow you to modify certain 
     functions. Arguments used to hook both filters and actions look the same.” in 
     the requirements:
 18. > Themes are required to use a unique slug as a prefix for anything in the public
     > namespace, including all custom function names, classes, hooks, public/global
     > variables, database entries (Theme options, post custom metadata, etc.)
 19. [Read the Codex changeset.](https://codex.wordpress.org/index.php?title=Theme_Review&diff=114800&oldid=114700)
 20. I was just wondering if there was any discussion regarding these changes to the
     requirements? I would love to have taken part in such a dialog. Hooks are bit 
     different when compared to the other items in the list. IMHO it is perfectly valid
     for a theme to include un-prefixed hooks. One of the most convincing use-cases
     is pluginPlugin A plugin is a piece of software containing a group of functions
     that can be added to a WordPress website. They can extend functionality or add
     new features to your WordPress websites. WordPress plugins are written in the 
     PHP programming language and integrate seamlessly with WordPress. These can be
     free in the WordPress.org Plugin Directory [https://wordpress.org/plugins/](https://wordpress.org/plugins/)
     or can be cost-based plugin from a third-party. integration. I’ve been using this
     practice for many months mainly inspired by [Rethinking Template Tags in Plugins](http://nacin.com/2010/05/18/rethinking-template-tags-in-plugins/).
     I really love this solution and think it’s great for automatic plugin/theme integration.
     [I use it myself here](https://github.com/mfields/nighthawk/blob/master/taxonomy.php#L23).
 21. I believe that introducing such a requirement may limit communication between 
     plugins and themes. I do my best to follow the guidelines laid out by the WPTRT.
     Can we discuss this topic more?
 22.  * ![](https://secure.gravatar.com/avatar/7d256f7b605361e4dc402138e2896ff727d2a13d669f1420a8644d12a90bb7af?
        s=32&d=mm&r=g)
      *  [Chip Bennett](https://profiles.wordpress.org/chipbennett/)  6:53 pm _on_ 
        March 19, 2012
      * Indeed; I changed that guideline to clarify the existing intent, which is that
        _everything_ belonging to the Theme that resides in the public namespace, must
        be uniquely prefixed.
      * I’m all in favor of using a consistent, standard nomenclature for hooksHooks
        In WordPress theme and development, hooks are functions that can be applied
        to an action or a Filter in WordPress. Actions are functions performed when
        a certain event occurs in WordPress. Filters allow you to modify certain functions.
        Arguments used to hook both filters and actions look the same.; unfortunately,
        no such standard exists. If/when it does, it will certainly be a benefit to
        developers and users alike, for exactly the reasons you stated.
         - ![](https://secure.gravatar.com/avatar/80fc42b69c5c0a909ae161ac7a2b9396ccad183353e0d2851164f1f9c158edc3?
           s=32&d=mm&r=g)
         -  [klikdewa](https://profiles.wordpress.org/klikdewa/)  6:25 am _on_ February
           13, 2017
         - [daftarlinksbobet2017](http://daftarlinksbobet2017.com)

### Leave a Reply 󠀁[Cancel reply](https://make.wordpress.org/themes/2012/03/14/theme-frameworks-and-namespacing-guidelines/?output_format=md#respond)󠁿

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fmake.wordpress.org%2Fthemes%2F2012%2F03%2F14%2Ftheme-frameworks-and-namespacing-guidelines%2F&locale=en_US)
to post a comment.

This site uses Akismet to reduce spam. [Learn how your comment data is processed.](https://akismet.com/privacy/)

# Post navigation

[← If any theme reviewers will be at SXSW…](https://make.wordpress.org/themes/2012/03/06/if-any-theme-reviewers-will-be-at-sxsw/)

[Custom Menus Implementation: Use theme_location instead of menu in wp_nav_menu() →](https://make.wordpress.org/themes/2012/03/16/custom-menus-implementation-use-theme_location-instead-of-menu-in-wp_nav_menu/)