These notes are somewhat universal to the child theme process, though likely somewhat out of date.
Get access to your site ∞
First you need to have direct access to your website. I use LFTP for ssh file transfers.
\lftp -p 22 -u USERNAME sftp://WEBSITE
More advanced website content push/pull ∞
I make a script,
pull.sh and a symlink to that same file, called
I make a complete backup of my wp-content folder, although you may wish to be more specific if you don't wish to download all of your images and other attachments.
The script will probably end up somewhere in my github (shell-random).
#!/bin/bash #dry_run=--dry-run if [ $0 = "./push.sh" ]; then mirror=--reverse fi \lftp \ -c ` # Execute commands, and exit. ` \ "\ open sftp://[email protected]/path/to/wp-content ;\ lcd wp-content mirror \ $dry_run \ $mirror \ --continue \ --delete-first \ --only-newer \ --parallel=3 \ --verbose=1 \ -x cache/* \ -x upgrade/* \ -x w3tc/* \ "\ ` # `
Begin your child theme ∞
Make a new directory called
PARENT_THEME-CHILD_THEME. For me, it was
Within that directory you will be creating
style.css as well as any php files you wish.
This is a minimal example:
/* Theme Name: Parament Simplified Theme URI: https://wordpress.com/theme/parament Description: Child theme for the Parament theme Author: spiralofhope Author URI: https://blog.spiralofhope.com/?p=2666 Template: parament Version: 1.0.0 */ @import url("../parament/style.css");
Other PHP ∞
You can add in arbitrary PHP files in the same directory as your
style.php . If -- before you began your journey with child themes -- you used to edit that theme's
content.php, and you want to have those changes become a part of this new child theme of yours..
- Copy your original theme's php to your new
Edit that php file freely.
That's it. I actually had to go and look that up to have someone other than the WordPress people tell me the obvious.
It's probably more complex than that, but this is as far as I've been.
Previewing your work ∞
It's bloody important you don't try to upload and activate your experimentation in order to view it!
My theme is called
parament-spiralofhope. I can preview it at:
IMPORTANT: If you use a cache plugin, you must empty your cache before you refresh this theme preview page. For my cache, it is a URL like this:
I ended up disabling my cache entirely to resolve other issues. Consider doing the same, at least for previewing.
Applying your child theme ∞
Administration Panels > Appearance > Themes
For me it is:
- If you use a speed/cache WordPress plugin, then clear its cache before previewing.
- Advanced cache settings can truly fuck everything up. If in doubt, disable that plugin while testing.
Control-F5to force your browser to discard its local cache.
Last updated 2020-01-12 at 00:41:57