Installation

Use Composer to easily install better-wordpress

Requirements

  • Composer >= 2.0
  • PHP >= 7.4
  • WordPress >= 5.7 (older versions may not be supported in the future)

The Easy Way

Let Composer create a new better-wordpress theme for you! Navigate to your site’s ./wp-content/themes folder and run the following command:

composer create-project open-function-computers-llc/wp-theme <theme-name>

Next, enter your newly created theme’s folder and run npm install.

cd <theme-name>
npm install

This will install support for Laravel Mix, which can be used to compile Sass, PostCSS, Vue, React and more, as well as handle vanilla JavaScript/CSS. (laravel-mix website)

The starter project contains example app.scss and app.js files in the src folder, to compile them simply run:

npx mix

To continuously monitor/rebuild app.js and app.scss, you can use:

npx mix watch

better-wordpress will automatically register the javascript and css with WordPress, just make sure you call wp_head() in your site’s <head> (example).

The Advanced Way

Navigate to your theme’s folder within the WordPress file structure (by default wp-content/themes/<theme>) and run the following command to install open-function-computers-llc/better-wordpress and its dependancies to your project.

# Composer Globally Installed
composer require open-function-computers-llc/better-wordpress

# Composer Locally Installed
php composer.phar require open-function-computers-llc/better-wordpress

Add Configuration File

Once you’ve installed the package, navigate to vendor/open-function-computers-llc/better-wordpress and copy config.example.php to the root of your theme folder. Rename this file simply to config.php.

Here’s what your theme folder should look like now:

style.css # Required by WordPress
index.php # Required by WordPress
screenshot.png # Required by WordPress
config.php # Renamed example better-wordpress config
composer.json # Generated by Composer
vendor/ # Generated by Composer
| open-function-computers/
| | better-wordpress/
| | | config.example.php # Original example better-wordpress config
| | | ... # Other package files
| ... # Other packages
... # Other theme files

Initializing

Next, follow these instructions to initialize better-wordpress in your project.