Skip to content

Yet another modern WordPress boilerplate with Composer, an easier configuration, and an improved folder structure.

License

Notifications You must be signed in to change notification settings

wp-jazz/wp-project-skeleton

Repository files navigation

WordPress Project Skeleton

Yet another modern WordPress boilerplate with Composer, an easier configuration, and an improved directory structure.

This boilerplate is based on Bedrock.

If you have the capability, please consider sponsoring Roots.

Overview

This boilerplate assumes you are familiar with Bedrock.

Differences with Bedrock:

  • The Web root directory is public instead of web.
  • The WordPress core directory is wordpress instead of wp.
  • The WordPress content directory is the same path as the Web root.
    • In vanilla WordPress, this is the /wp-content directory.
    • In Bedrock, this is the /web/app directory.
    • In Jazz, the directory structure is simplified:
      • /public/plugins
      • /public/mu-plugins
      • /public/themes
      • /public/uploads
      • /public/wordpress
  • The primary configuration file in Bedrock (/config/application.php) is split across multiple files:
    • /config/bootstrap.php — Bootstraps the environment variables, WordPress environment type, and configuration files.
    • /config/application.php — Production configuration for your WordPress application.
    • /config/wordpress.php — Base configuration for WordPress (equivalent of wp-config.php).
  • Roots' WP_ENV constant is superseded by WordPress' WP_ENVIRONMENT_TYPE constant.
    • The former is still defined because its required by dependencies and plugins by Roots.

Requirements

Installation

  1. Create a new project:

    composer create-project wp-jazz/wp-project-skeleton
  2. Update environment variables in the .env file.

    Wrap values that may contain non-alphanumeric characters with quotes, or they may be incorrectly parsed.

    • Database variables:

      • DB_NAME — Database name

      • DB_USER — Database user

      • DB_PASSWORD — Database password

      • DB_HOST — Database host

      • Optionally, you can define DATABASE_URL for using a DSN instead of using the variables above:

        DATABASE_URL="mysql://user:[email protected]:3306/db_name"
    • WP_ENVIRONMENT_TYPE — Set to environment (development, staging, production)

    • WP_HOME — Full URL to WordPress home (https://example.com)

    • WP_SITEURL — Full URL to WordPress including subdirectory (https://example.com/wordpress)

    • AUTH_KEY, SECURE_AUTH_KEY, LOGGED_IN_KEY, NONCE_KEY, AUTH_SALT, SECURE_AUTH_SALT, LOGGED_IN_SALT, NONCE_SALT

  3. Add plugin(s) in public/plugins and public/mu-plugins, and theme(s) in public/themes either:

    • as you would for a normal WordPress site (add an exception to the .gitignore if you want to index them)
    • or as Composer dependencies.
  4. Set the document root on your Web server to the public directory: /path/to/site/public/.

  5. Access WordPress admin at https://example.com/wordpress/wp-admin/.

Contributing

Contributions are welcome from everyone. We have contributing guidelines to help you get started.

Acknowledgements

This boilerplate is based on the solid work of many that have come before me, including:


🎷

About

Yet another modern WordPress boilerplate with Composer, an easier configuration, and an improved folder structure.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published