|
| 1 | +# Create WP Theme |
| 2 | + |
| 3 | +Create WP Theme is a node command line tool that will scaffold a new WordPress theme with an opinionated file structure and just the right amount of starter code to get a developer started building a modern WordPress theme. This package contains just the `create-wp-theme` command, all of the actual boilerplate code comes from [WP Theme Assets](https://github.com/dreamsicle-io/wp-theme-assets). |
| 4 | + |
| 5 | +## Usage |
| 6 | + |
| 7 | +Open a terminal, `cd` to the `/path/to/wordpress/wp-content/themes` directory of a local WordPress instance, and fire the `create-wp-theme` command. |
| 8 | + |
| 9 | +```shell |
| 10 | +create-wp-theme [options] <file> |
| 11 | +``` |
| 12 | + |
| 13 | +## Getting Started |
| 14 | + |
| 15 | +All that is necessary to start using the tool is a single argument of `file`, which corresponds to a param-cased string that will serve as the theme directory, the WordPress text-domain, and the package name. This will also serve as regular expression to replace all instances of `wp-theme` in the cloned package files. |
| 16 | + |
| 17 | +### 1. Run the `create-wp-theme` command |
| 18 | + |
| 19 | +```shell |
| 20 | +create-wp-theme my-theme |
| 21 | +``` |
| 22 | + |
| 23 | +### 2. Follow the prompts |
| 24 | + |
| 25 | +Once the command has been run, and the tool finds that the directory is unique, The tool will walk through a set of prompts that can be filled out inorder to customize the output of the package. |
| 26 | + |
| 27 | +```shell |
| 28 | +The following tool will help you configure your new theme. |
| 29 | +For each setting, set a value and hit "Enter" to continue. |
| 30 | + |
| 31 | +Theme Name: (WP Theme) |
| 32 | +Version: (0.0.1) |
| 33 | +Template: () |
| 34 | +Theme URI: (https://github.com/example/wp-theme) |
| 35 | +Theme Bugs URI: (https://github.com/example/wp-theme/issues) |
| 36 | +Theme Repository URI: (git@github.com:example/wp-theme.git) |
| 37 | +Theme Repository Type: (git) |
| 38 | +Description: (This theme was generated using create-wp-theme.) |
| 39 | +Author: (Example, INC.) |
| 40 | +Author Email: (hello@example.com) |
| 41 | +Author URI: (https://www.example.com) |
| 42 | +License: (UNLICENSED) |
| 43 | +Tags: (accessibility-ready, translation-ready) |
| 44 | +WP Version Required: (5.0.0) |
| 45 | +WP Version Tested: (5.0.0) |
| 46 | +Function Prefix: (wp_theme) |
| 47 | +Class Prefix: (WP_Theme) |
| 48 | +``` |
| 49 | + |
| 50 | +## Logging |
| 51 | + |
| 52 | +The tool will log its progress and errors in the console, exiting on completion and fatal errors. |
| 53 | + |
| 54 | +```shell |
| 55 | +Creating theme: WP Theme in C:\Users\noahm\Code\create-wp-theme-dev\app\public\wp-content\themes\my-theme |
| 56 | + |
| 57 | +Repo cloned: https://github.com/dreamsicle-io/wp-theme-assets.git --> C:\Users\noahm\Code\create-wp-theme\tmp |
| 58 | +package-lock.json cleaned: C:\Users\noahm\Code\create-wp-theme\tmp\package\package-lock.json |
| 59 | +package.json written: C:\Users\noahm\Code\create-wp-theme\tmp\package\package.json |
| 60 | +File Renamed: C:\Users\noahm\Code\create-wp-theme\tmp\package\includes\class-wp-theme-assets.php |
| 61 | +File built: C:\Users\noahm\Code\create-wp-theme\tmp\package\includes\class-wp-theme-assets.php |
| 62 | +License written: C:\Users\noahm\Code\create-wp-theme\tmp\package\LICENSE |
| 63 | +Theme copied: C:\Users\noahm\Code\create-wp-theme-dev\app\public\wp-content\themes\my-theme |
| 64 | +Repo cleaned: C:\Users\noahm\Code\create-wp-theme\tmp |
| 65 | + |
| 66 | +Theme created: WP Theme in C:\Users\noahm\Code\create-wp-theme-dev\app\public\wp-content\themes\my-theme |
| 67 | +``` |
| 68 | + |
| 69 | +## Options |
| 70 | + |
| 71 | +The tool offers several options that will serve as defaults for the tool's prompt. These options can be used to customize the default options of the tool allowing the developer to go through the prompts faster. |
| 72 | + |
| 73 | +```shell |
| 74 | +create-wp-theme -X 1.0.0 -A Dreamsicle -E hello@dreamsicle.com -u https://www.dreamsicle.com my-theme |
| 75 | +``` |
| 76 | +> **Note:** If the option value has spaces in it, wrap it in quotes. For example - `"Example, Inc"`. |
| 77 | +
|
| 78 | +**The above would set the defaults for the following prompts:** |
| 79 | + |
| 80 | +```shell |
| 81 | +Author: (Dreamsicle) |
| 82 | +Author Email: (hello@dreamsicle.com) |
| 83 | +Author URI: (https://www.dreamsicle.com) |
| 84 | +``` |
| 85 | + |
| 86 | +## Help |
| 87 | + |
| 88 | +To get help with the tool and to learn more about usage and the available options, use the `--help` or `-h` flag. This will output all help information available including how to use the command, option flags, option descriptions, and option defaults. |
| 89 | + |
| 90 | +```shell |
| 91 | +create-wp-theme --help |
| 92 | +``` |
| 93 | + |
| 94 | +**The above would ouput the following help information:** |
| 95 | + |
| 96 | +```shell |
| 97 | +Usage: create-wp-theme [options] <file> |
| 98 | + |
| 99 | +Options: |
| 100 | + -V, --version output the version number |
| 101 | + -N, --themeName <name> The theme name (default: "WP Theme") |
| 102 | + -X, --themeVersion [version] The theme version (default: "0.0.1") |
| 103 | + -T, --themeTemplate [theme] The parent theme if this is a child theme (default: "") |
| 104 | + -U, --themeURI [uri] The theme URI (default: "https://github.com/example/wp-theme") |
| 105 | + -B, --themeBugsURI [uri] The theme bugs URI (default: "https://github.com/example/wp-theme/issues") |
| 106 | + -R, --themeRepoURI [uri] The theme repository URI (default: "git@github.com:example/wp-theme.git") |
| 107 | + -r, --themeRepoType [type] The theme repository type (default: "git") |
| 108 | + -d, --themeDescription [description] The theme description (default: "This theme was generated using create-wp-theme.") |
| 109 | + -A, --themeAuthor [name] The theme author (default: "Example, INC.") |
| 110 | + -E, --themeAuthorEmail [email] The theme author email (default: "hello@example.com") |
| 111 | + -u, --themeAuthorURI [uri] The theme author URI (default: "https://www.example.com") |
| 112 | + -L, --themeLicense [spdx] The theme license as a valid SPDX expression (default: "UNLICENSED") |
| 113 | + -t, --themeTags [tags] A CSV of WordPress theme tags (default: "accessibility-ready, translation-ready") |
| 114 | + -W, --wpVersionRequired [version] The version of WordPress the theme requires (default: "5.0.0") |
| 115 | + -w, --wpVersionTested [version] The version of WordPress the theme has been tested up to (default: "5.0.0") |
| 116 | + -F, --functionPrefix [prefix] The prefix for PHP functions (default: "wp_theme") |
| 117 | + -C, --classPrefix [prefix] The prefix for PHP classes (default: "WP_Theme") |
| 118 | + -h, --help display help for command |
| 119 | +``` |
| 120 | +
|
0 commit comments