Skip to content

Instantly share code, notes, and snippets.

@dotherightthing
Created November 2, 2018 06:38
Show Gist options
  • Save dotherightthing/97c6949c972831d93b95394ff0cbfeb1 to your computer and use it in GitHub Desktop.
Save dotherightthing/97c6949c972831d93b95394ff0cbfeb1 to your computer and use it in GitHub Desktop.
[Organising theme functionality] #wordpress

Organising theme functionality

Compartmentalization

wp-content/plugins only contains third-party plugins, no code in here is modified, and the site should not be deadlined by any of these plugins being disabled / removed.

wp-content/themes should contain the code related to presentation of the front-end. The trick is not not overload the theme (functions.php and other theme-related files) with code not directly related to presentation.

mu-plugins/ contains all of your implementation-specific business logic. Things in here should never be disabled, and are required for operations.

Themes

Themes cannot include plugins.

Themes cannot require plugins to work.

Themes may only recommend plugins that are available in the WordPress.org Plugin Directory.

Themes may use TGM Plugin Activation to recommend plugins.

Themes may include libraries such as option frameworks (these must pass the requirements).

Specialty Themes

A WordPress theme must be developed to change the look of a website and avoid offering functionality embedded in its core. (...) But sometimes, a project requires that design and functionality work together. In this case, we have an exception, and the exception's name, used throughout the WordPress market, is "specialty themes".

A "specialty theme" is a kind of WordPress theme that has a very specific purpose like a crowdfunding website or a learning management system (LMS). While it can be extended with WordPress hooks (actions and filters) or redesigned with child themes, websites built with these themes would have to work with the same theme over the course of its lifetime. That's why it's not considered a "bad practice" for these themes to invade the plugin territory.

It's certainly a grey area: ThemeForest, for instance, doesn't allow invading the plugin territory even for specialty themes. I'd like to hear about what you think, too, so let's chat in the comments!

Thoughts

  • The WordPress Theme Review page doesn't mention or condone Must Use plugins
  • Must Use plugins still split functionality into manageable chunks
  • A custom theme for yourself is surely a specialty theme, but you may still want to share parts of the functionality with others
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment