From Ninfa’s on Navigation for my grandmother’s 84th birthday.
My talk from WordCamp Nepal 2013 is now live on WordPress.tv.
From M.Y.China. The flight from Ho Chi Minh City to San Francisco was really hard this time around; my knees are definitely feeling the wear and tear of traveling for long stretches of time so often.
Really fantastic Mexican lunch at Khoi Thom in Ho Chi Minh City.
I’ve been playing around with WP-CLI, a tool to manage WordPress by command-line, a lot lately and one of my favorite parts of it is the things that it can do with themes.
Currently there are two well-known ways of building a theme with _s:
- Manual: Clone the _s GitHub repository directly into
/wp-content/themes/and go through the steps of renaming text domains, function names, DocBlocks, and prefixed handles
- Automatic: Go to underscores.me, enter a desired theme name and advanced options (optional), generate a theme, download the theme, unzip the theme, and put it into
I prefer the manual approach because I’m an active contributor and committer to _s and working with Git and command-line text replacement feels natural to me. Plus, I like a bit of control.
It is tedious, though, and WP-CLI introduces a new way of kicking off an _s-based theme that molds the above two approaches into one delightful solution.
Here’s how to do it.
- Install WP-CLI. It’s incredibly painless.
- From within the WordPress install directory run the following command:
wp scaffold _s theme-slug --theme_name="The PAM Theme" --author="Philip Arthur Moore" --author_uri="https://philiparthurmoore.com/"
- That’s it!
You’ll of course need to replace my values with yours, but otherwise that’s really all there is to it. Once you’re done with the above two steps then you can happily navigate to
wp-content/themes/theme-slug and get to work.
The added benefit of this approach is all the additional goodies that come with WP-CLI. If you’re a theme builder, study the theme list and integrate it into your workflow. It’ll make common actions like switching themes and checking theme paths feel so much quicker.