/wordpress-project-starter

An opinionated starter for WordPress projects.

Primary LanguagePHPGNU General Public License v2.0GPL-2.0

WordPress Project Starter

An opinionated starter for WordPress projects.


Features

  • Composer for plugin management
  • WordPress Scripts for JavaScript and CSS bundling in the custom theme
  • TailwindCSS support in the custom theme
  • Lefthook for pre-commit hooks
  • Github Actions for automated assertions and deployments via RSYNC
  • Linting support for popular VS Code extensions like ESLint, Stylelint, Prettier, and PHP Sniffer & Beautifier

Installation

For a new project, delete the wp-content directory and clone this repository in its place.

git clone https://github.com/gregrickaby/wordpress-project-starter wp-content

You could also use this repository as a template for a new project.

Run npm i to install the dependencies.


Linting

This project uses ESLint, Stylelint, PHPCS, PHPCBF, and Prettier for code linting and formatting. It also has support for automatic fixing of many linting errors as you save via support for popular VS Code extensions.

If needed, you can still lint from the CLI. From the root of the repository, run the following commands:

npm run format - Formats all files using Prettier and PHPCBF

npm run lint - Runs ESLint, Stylelint, and PHPCS

Github Actions is also configured to lint code on each Pull Request. Learn more about configuring branch projection rules and status checks.


RSYNC Deployments

This project uses Github Actions to deploy to a remote server via RSYNC.

To use this feature, you'll need to add the following secrets to Github:

  • REMOTE_PRIVATE_KEY - The private key of the remote server
  • REMOTE_HOST - The hostname of the remote server
  • REMOTE_USER - The username of the remote server
  • REMOTE_PATH - The path to the /wp-content directory on the remote server

Learn how to configure secrets with Github Actions and more about configuring RSYNC deployments.