Understanding an Existing WPLib-based Website

(Impatient for the details? Skip to Site Components.)

So you have just been handed a website to maintain or enhance that was developed using WPLib as a base. Your first thought is probably OMG WTF!!!

However (assuming the original developer(s) followed WPLib best practices, naming conventions and coding style) you have just been handed a gift! This site will likely be the easiest to understand, maintain and enhance of any non-trivial WordPress-based website you have ever inherited, by far.

WPLib-based Sites Have a Consistent Architecture

How so you ask? Consistency. Well-structured WPLib-sites are very structured in their architecture and that results in a high level of code consistency, across modules and across developers. Once you learn just a few concepts you'll know exactly where most code will be found by the code's purpose, and you need to build something new you'll know where it should go.

If this were Ruby on Rails we'd even call it "opinionated" but we are a bit more humble than that.

Yet Familiar to WordPress Coders

Even though WPLib-based sites allow for managing more complexity than normal WordPress development processes most everything about it will feel familiar to existing Wordpress backend engineers and much of it to existing WordPress front-end developers.

Use a Little or a Lot

WPLib is a library and not a framework so, which there is great benefit to use it throughout a site you only need use it where you want to gain its benefits. Everywhere else you can revert back to standard WordPress coding approaches.

Architecture Benefits

Site Components

A WPLib-based website will included many of the following components with the obviously marked-optional components not being required:

  1. WordPress Core
  2. WPLib: See github.com/wplib/wplib
  3. Application (App)
  4. Theme*
  5. Partials
  6. Plugin(s)*
  7. Helper Modules and Methods
  8. Modules
  9. Models, Views and Items
  10. Lists
  11. Runmodes

* That conform(s) with WordPress conventions.

WordPress Core

You will find WordPress as expected, but installed with directory structure that best fits hosting and workflow for the site. WordPress Core Directory Structure

WPLib: See github.com/wplib/wplib

WordPress Core Directory Structure

Application (App)

WordPress Core Directory Structure

Theme *

WordPress Core Directory Structure

Partials

Plugin(s)*

Modules

WordPress Core Directory Structure

Helper Modules and Methods

Models, Views and Items

Lists

Runmodes

* That conform(s) with WordPress conventions.

WordPress VIP

When using WordPress VIP where everything has to be self-contained in the theme, simply put WPLib and your App into the theme directory as /wplib/ and /{app_name}-app/ directories (or a Composer /vendor/ directory.) Include them from these locations from within your theme's function.php file. And then everything else should work the same.