Creating a Child Theme
Master WordPress child theme development best practices
Core Skills You'll Master
Custom Header Creation
Learn to add professional theme information including name, author, and version details that appear in WordPress admin.
Style Sheet Management
Master the wp_enqueue_script() function to properly import and manage parent and child theme stylesheets.
Theme Architecture
Understand child theme structure and why it prevents customizations from being lost during updates.
Directly modifying parent themes leads to lost customizations when the theme updates. Child themes preserve your work while maintaining the ability to receive parent theme updates.
File System Setup Process
Navigate to Themes Directory
Access your local server's themes folder through the wp-content/themes path on either Mac (MAMP) or Windows (XAMPP) systems.
Create Child Theme Folder
Establish a new directory named 'obscure-mrp' to house your child theme files, following WordPress naming conventions.
Initialize Style Sheet
Create the foundational style.css file within your child theme folder using your preferred code editor.
File Path Differences by Operating System
| Feature | Mac (MAMP) | Windows (XAMPP) |
|---|---|---|
| Base Path | Hard Drive > Applications > MAMP | C: > xampp |
| Project Location | htdocs > mrpBlog | htdocs > mrpBlog |
| Themes Directory | wp-content > themes | wp-content > themes |
The header comment block in style.css contains metadata that WordPress reads to display theme information in the admin dashboard. This includes theme name, description, author, and parent template reference.
Essential Header Fields
Theme Name
The display name shown in WordPress admin. Should be descriptive and unique from the parent theme.
Template Reference
The 'Template: obscure' field tells WordPress which parent theme this child theme extends and depends upon.
Version Control
Track your theme development with version numbers, starting at 1.0 for initial release.
Using wp_enqueue_style() instead of @import ensures proper loading order, prevents duplicate loading, and maintains compatibility with caching plugins and performance optimizations.
Functions.php Implementation
Create Functions File
Establish functions.php in your child theme directory to house the stylesheet enqueue functionality.
Add Enqueue Function
Implement the theme_enqueue_styles() function to properly load both parent and child stylesheets in correct order.
Hook to WordPress
Use add_action() to connect your enqueue function to the wp_enqueue_scripts hook for proper timing.
Theme Activation Verification
Use the correct port (8888 for Mac, default for Windows) and path structure
Locate your new child theme in the available themes list
Verify the header information displays correctly as 'Monteith Restoration and Performance'
Ensure the child theme loads parent styles correctly and displays identically to Obscure theme
Your child theme now inherits all parent theme functionality while providing a safe environment for customizations. The identical appearance confirms proper parent style inheritance.
Key Takeaways
