2017 © Pedro Pelรกez
 

project wp-multitenancy-add-site

Adds WordPress sites to handpressed/wp-multitenancy-boilerplate.

image

handpressed/wp-multitenancy-add-site

Adds WordPress sites to handpressed/wp-multitenancy-boilerplate.

  • Friday, June 1, 2018
  • by handpressed
  • Repository
  • 0 Watchers
  • 1 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

WordPress Multitenancy Add Site

Adds WordPress sites to WP Multitenancy Boilerplate., (*1)

Features

  • Improved directory structure
  • Easy WordPress configuration with environment and constants files
  • Environment variables with PHP dotenv
  • Enhanced security (separated web root and secure passwords with roots/wp-password-bcrypt)
  • WordPress multitenancy (a single instance of WordPress core, themes and plugins serving multiple sites)

Requirements

  • PHP 7.4+
  • Composer

Prerequisites

A WordPress instance installed with WP Multitenancy Boilerplate., (*2)

Installation

$ composer create-project handpressed/wp-multitenancy-add-site {directory}

$ cd {directory}

Replace {directory} with the name of your new WordPress project, e.g. its domain name., (*3)

Composer will symlink the existing WordPress instance added with WP Multitenancy Boilerplate in /var/opt/wp to web/wp (see Directory Structure)., (*4)

Composer will also symlink /var/opt/wp/wp-content/themes to web/app/themes, /var/opt/wp/wp-content/plugins to web/app/plugins and /var/opt/wp/wp-content/mu-plugins to web/app/mu-plugins., (*5)

Configuration

Open the conf/.env file and add the new site's home URL (WP_HOME) and database credentials (DB_NAME, DB_USER, DB_PASSWORD). You can also define the database $table_prefix (default is wp_) if required., (*6)

Set the site's vhost document root to /path/to/{directory}/web., (*7)

Themes

Add themes in web/app/themes as you would for a normal WordPress install. You can use the WordPress admin to update them., (*8)

Plugins

WordPress Packagist is already registered in the composer.json file so any plugins from the WordPress Plugin Directory can easily be required., (*9)

To add a plugin, use composer require <namespace>/<packagename> from the command-line. If it's from WordPress Packagist then the namespace is always wpackagist-plugin, e.g.:, (*10)

$ composer require wpackagist-plugin/wp-optimize

Whenever you add a new plugin or update WordPress core, run composer update to install your new packages., (*11)

Themes and plugins are installed in the symlinked themes and plugins directories in /var/opt/wp/wp-content and will be available to all multitenancy sites., (*12)

Note: Some plugins may make modifications to the core wp-config.php file. Any modifications to wp-config.php that are needed by an individual site should be moved to the site's conf/wp-constants.php file., (*13)

Constants

Put custom core, theme and plugin constants in conf/wp-constants.php., (*14)

Directory Structure

โ”œโ”€โ”€ composer.json             โ†’ Manage versions of WordPress, plugins and dependencies
โ”œโ”€โ”€ conf                      โ†’ WordPress configuration files
โ”‚   โ”œโ”€โ”€ .env              โ†’ WordPress environment variables (WP_HOME, DB_NAME, DB_USER, DB_PASSWORD required)
โ”‚   โ”œโ”€โ”€ wp-constants.php      โ†’ Custom core, theme and plugin constants
โ”‚   โ”œโ”€โ”€ wp-env-config.php     โ†’ Primary WordPress config file (wp-config.php equivalent)
โ”‚   โ””โ”€โ”€ wp-salts.php          โ†’ Authentication unique keys and salts (auto generated)
โ”œโ”€โ”€ vendor                    โ†’ Composer packages (never edit)
โ””โ”€โ”€ web                       โ†’ Web root (vhost document root)
    โ”œโ”€โ”€ app                   โ†’ wp-content equivalent
    โ”‚   โ”œโ”€โ”€ mu-plugins        โ†” Must-use plugins symlinked to /var/opt/wp/wp-content/mu-plugins
    โ”‚   โ”œโ”€โ”€ plugins           โ†” Plugins symlinked to /var/opt/wp/wp-content/plugins
    โ”‚   โ”œโ”€โ”€ themes            โ†” Themes symlinked to /var/opt/wp/wp-content/themes
    โ”‚   โ””โ”€โ”€ uploads           โ†’ Uploads
    โ”œโ”€โ”€ index.php             โ†’ Loads the WordPress environment and template (never edit)
    โ””โ”€โ”€ wp                    โ†” WordPress core symlinked to /var/opt/wp (never edit)
        โ””โ”€โ”€ wp-config.php     โ†’ Required by WordPress - loads conf/wp-env-config.php (never edit)

โ†” denotes a symlink., (*15)

See Also

WordPress Substratum, (*16)

Credit

Inspired by roots/bedrock and wpscholar/wp-skeleton., (*17)

The Versions

01/06 2018

dev-master

9999999-dev

Adds WordPress sites to handpressed/wp-multitenancy-boilerplate.

  Sources   Download

MIT

The Requires

 

wordpress composer cms wpackagist multitenancy phpdotenv