gaambo / vanilla-wp

WordPress boilerplate for vanilla WordPress installations with modern development tools and src directory for theme assets.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WordPress Vanilla Boilerplate

WordPress boilerplate for vanilla WordPress installations with modern development Tools (Docker, WP CLI, PHPCS).

Quick Links

Features

Gaambos Vanilla WP takes vanilla WordPress and enhances it through the following features:

Requirements

Installation

  1. Create a new project
    Clone git repository
    $ git clone git@github.com:gaambo/vanilla-wp.git website-dir
    $ cd website-dir && rm -rf .git
    $ git init
  2. Set file Permissions (when on WSL2 or Linux)
    1. Choose which user should WordPress/the server run as and you want to edit the files (in most cases it's your user)
    2. Create a .env file in the root directory to set the the user
      DOCKER_USER=0 # output from $(id -u)
      DOCKER_USER_GROUP=0 # output from $(id -g)
    3. Ensure the project-folder (and public) belong to this user
         chown -R 1000:1000 ./public
    More Information
  3. Start Docker containers
    docker compose -f "docker.compose.development.yml" up -d --build
  4. Install WordPress (See Wiki)
    $ .\util\cli.sh wp core download --path='./public'
    Then run .\util\cli.sh wp core install with the according arguments or just open up the website in your browser to start WordPress famous 5 minute installation.
  5. Install dependencies
    $ composer install
  6. Install Theme
    My _g Theme works perfectly with this boilerplate. I suggest you use this one:
    $ cd public/wp-content/themes/${themename}
    $ git clone git@github.com:gaambo/_g-wp-theme.git .
    $ rm -rf .git
    $ npm install
    $ composer install
    Then exclude the path in gitignore: !public/wp-content/themes/${themename}

All other themes can be installed as usual (unzip in public/wp-content/themes, upload via FTP,...). You can also use wpcli:

$ ./util/cli.sh wp plugin theme twentynineteen
  1. Install Core Functionality Plugin (optional)
    My Core Functionality Plugin works perfectly with this boilerplate. I suggst you use it to for complete site-projects to put all site-specific functionality in it:
    $ git clone git@github.com:gaambo/wp-core-functionality-plugin.git public/wp-content/mu-plugins/core-functionality
    $ rm -rf .git
    Then exclude the path in gitignore: !public/wp-content/mu-plugins/core-functionality
  2. Install plugins:
    $ ./util/cli.sh wp plugin install autodescription
  3. If developing a custom theme or plugin which you want to include in the repository exclude it in .gitignore.
  4. If developing a custom theme or plugin which you want to have PHP linting available include it in phpcs.xml via <include-pattern>PATH</include-pattern>.
  5. Set the document root on your webserver to the public folder: /path/to/site/public/
  6. Access WordPress admin at https://example.com/wp-admin/

Deployment

PHP Deployer in conjunction with gaambos WordPress recipes is used. A documentation of all available tasks can be found in the README.md of the package. The deploy.php is based on the default/vanilla deploy recipe from this package and edits localhost settings for setting document root and using Docker for WP CLI.

Before running any tasks you have to configure SSH acces to the hosts defined in util/deploy.yml via ~/.ssh/config.

Run scripts in scripts dir via .\util\cli.sh wp eval-file ./scripts/roles-capabilities.php (on server).

Documentation

Documentation can be found in our GitHub wiki

Contributing

Contributions are welcome from everyone. Just open an issue or contact me.

About

WordPress boilerplate for vanilla WordPress installations with modern development tools and src directory for theme assets.


Languages

Language:PHP 90.6%Language:Dockerfile 8.2%Language:Shell 1.2%