A framework for building a WordPress child theme for the WSUWP Spine Parent Theme at WSU.
- Create a new repository under the Washington State University organization. This should have a name like "website.wsu.edu" that matches the address of the site where the theme will be used. If this is a more general theme, feel free to use something like "WSUWP Descriptive Theme".
- Clone this WSUWP Spine Child Theme Skeleton repository to a directory on your computer named for the new theme.
- Change into that new directory.
- Remove the
.git
directory that provides the history for the WSUWP Spine Child Theme Skeleton project. - Initialize a new git repository in the directory.
- Add the new repository you created in step 1 as the
origin
remote.
git clone https://github.com/washingtonstateuniversity/WSUWP-Spine-Child-Theme-Skeleton.git website-theme-dev
cd website-theme-dev
rm -fr .git
git init
git remote add origin https://github.com/washingtonstateuniversity/website.wsu.edu.git
git status
There are several places throughout the WSUWP Child Theme Skeleton code that should be changed to match the new theme.
- The theme header portion of the stylesheet in
css/00-banner.css
should be adjusted. - Update the project name in
composer.json
. - Update the project name and URL in
package.json
. - Update the ruleset name and description in
phpcs.ruleset.xml
. - Update the name and description of the project in
README.md
, replacing all of this text. - Update the name, copyright, and URL in
LICENSE
. - If desired, replace
screenshot.png
with a screenshot of the child theme.
- Install the NPM dependencies.
- Install the Composer dependencies.
- Ensure code standards are sniffed properly.
- Ensure CSS files are properly processed into
style.css
andstyle.css.map
.
npm install
composer install
grunt phpcs
grunt
The theme should now be in its initial state, with all pieces renamed to fit the new project. An initial commit can be added with all of these files.
- Check
git status
to be sure only the intended files are being added. - Add all files to staging.
- Add an initial commit.
- Push the initial commit to the master branch on the origin remote.
git status
git add -A
git commit -m "Initial commit"
git push origin master
The child theme CSS is maintained in the css/
directory. Grunt tasks are responsible for concatenating these files in alphabetical order, running autoprefixer, and then linting the compiled CSS for errors. The final destination for the CSS is style.css
. A source map is created in style.css.map
.
- CSS should be added and edited in the
css/
directory. - The built
style.css
is automatically generated and tracked in version control. - Run
grunt
to generatestyle.css
before committing changes. - Use
grunt serve
to start a local web server and view the style guide.
When JavaScript is added to the theme, similar tasks can be added for linting, concatenating, and minifying the JavaScript as needed.