What folder is your parent theme in? The Template:
line needs to contain the folder name of your parent theme, and capitalization matters.
Also, bear in mind that using @import
is no longer considered best practice and it’s now recommended to use the functions.php
method as detailed in the Codex: http://codex.wordpress.org/Child_Themes If you do continue to use it, though, you’ll probably need to change that line as well, to point towards the correct folder.
Thread Starter
vi32
(@vi32)
My parent theme is in the under “This PC” > “Downloads” and under “spectrum” folder. Is that what you’re referring to? Or did you mean my File Manager in my host?
I just realized I have it capitalized in Template… but the folder is not capitalized… so I will change it to lower case.
For the functions.php, are you referring to this? (taken from the site your provided)
<?php // Opening PHP tag – nothing should be before this, not even whitespace
// Custom Function to Include
function favicon_link() {echo ‘<link rel=”shortcut icon” type=”image/x-icon” href=”/favicon.ico” />’ . “\n”;}
add_action( ‘wp_head’, ‘favicon_link’ );
How do I customize it for my parent theme?
Thank you so much for your help, Stephen.
The bare minimum you need in your functions.php
is:
<?php
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
That’s the function that takes care of adding the parent theme’s stylesheet. Since you’ve already got some code in your functions.php
, you can just add that function to what you’ve already entered:
<?php // Opening PHP tag - nothing should be before this, not even whitespace
// Custom Function to Include
function favicon_link() {echo '<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />' . "\n";}
add_action( 'wp_head', 'favicon_link' );
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
Thread Starter
vi32
(@vi32)
<?php
add_action( ‘wp_enqueue_scripts’, ‘theme_enqueue_styles’ );
function theme_enqueue_styles() {
wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’
Is the above what I should enter in its entirety and verbatim?
Thanks!
Yes, you can copy-and-paste exactly what I posted.
Thread Starter
vi32
(@vi32)
This is the message I got:
Unpacking the package…
Installing the theme…
The package could not be installed. The theme is missing the style.css stylesheet.
Theme install failed.
After I tried to upload the following zip file entitled style.css:
/*
Theme Name: Spectrum Child
Theme URI: http://healthylifewithvi.com/
Description: Child Theme for Spectrum by Vi
Author: Vi
Template: spectrum
Version: 2.1.2
*/
<?php
add_action( ‘wp_enqueue_scripts’, ‘theme_enqueue_styles’ );
function theme_enqueue_styles() {
wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’
What did I do wrong now? Thank you!
Thread Starter
vi32
(@vi32)
Never mind! I figured it out! My child theme is active now!
Thank you so much for your help, Stephen!!! 🙂