I'm using a child theme with HTML5 Blank as the parent theme. I've used this before without any issue but for some reason I'm now getting the following error on my themes page -
Broken Themes
The following themes are installed but incomplete.
Name Description
HTML5 Blank Child Theme The parent theme is missing. Please install the "html5blank" parent theme.
This is what I have in my folder -
style.css
/*
Theme Name: HTML5 Blank Child Theme
Description: A child theme of the HTML5 Blank WordPress theme
Author: Mike Whitehead
Template: html5blank
Version: 1.0.0
*/
I've tried numerous different variations on this - also copying the official wordpress guide. The above wording worked for me on my last project so don't know why it won't work now.
This is my functions file -
functions.php
<?php
function my_theme_enqueue_styles() {
$parent_style = 'html5blank-style'; // This is 'twentyfifteen-style' for the Twenty Fifteen theme.
wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style',
get_stylesheet_directory_uri() . '/style.css',
array( $parent_style ),
wp_get_theme()->get('Version')
);
}
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
?>
Not sure why this isn't working. Any assistance would be appreciated.
The child themes style.css 'Template' tag should match that of the parent themes folder name eg.
/*
Theme Name: HTML5 Blank Child Theme
Description: A child theme of the HTML5 Blank WordPress theme
Author: Mike Whitehead
Template: html5blank-stable
Version: 1.0.0
*/
As per the WordPress Codex page on Child Themes - https://codex.wordpress.org/Child_Themes
"The Template line corresponds to the directory name of the parent theme. The parent theme in our example is the Twenty Fifteen theme, so the Template will be twentyfifteen. You may be working with a different theme, so adjust accordingly."
Get Your Parent Theme's Textdomain and put it as child theme's Template name. Let's say your Parent theme's Style.css header like this...
/*
Theme Name: HTML5 Parent Theme
Description: A HTML5 Blank Parent WordPress theme
Author: Mike Whitehead
Text domain: html5blank
Version: 1.0.0
*/
Then you can use this Text domain name into your child theme like this..
/*
Theme Name: HTML5 Blank Child Theme
Description: A child theme of the HTML5 Blank WordPress theme
Author: Mike Whitehead
Template: html5blank
Version: 1.0.0
*/
Related
I know this has been brought up a million times on here, but I have followed various solutions to no avail. My child theme stylesheet just won't change. It actually seems like any changes I make to the child functions.php don't take effect.
This is the closest post to my issue is this one but the answer about cache busting hasn't worked for me. I am kind of thinking it has to do with how the parent theme enqueues child theme styles automatically, but I don't know how to override that.
functions.php styles enqueue:
// Load styles:
add_action( 'wp_enqueue_scripts', 'main_styles' );
function main_styles() {
//* Bootstrap CSS
wp_enqueue_style('bootstrap-style', 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css');
//* Parent CSS
wp_enqueue_style( 'corporate-plus',
get_template_directory_uri() . '/style.css' );
//* Child theme CSS
$cache_buster = date("YmdHi", filemtime( get_stylesheet_directory() . '/style.css'));
wp_enqueue_style( 'yunev-corporate-plus',
get_stylesheet_directory_uri() . '/style.css',
array( 'corporate-plus '),
$cache_buster
);
}
child theme style.css theme comments:
/*
Theme Name: Yunev Custom
Description: Yunev Custom - Corporate Plus Child Theme
Template: corporate-plus
Version: 1.1.2
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
Text Domain: yunevcorporatepluschild
*/
(I removed the author and such for this post)
I customized this child theme a while ago and the custom styles are working, but any changes I make now don't propagate. I have cleared cloudflare cache, cache plugin, everything I can think of. It's driving me crazy.
The child style version that I get in the browser is always '1.0.1'. Any troubleshooting tips would be much appreciated.
Just try to rename your stylesheet or reupload your theme.
I'm having so much trouble setting up a child theme of the html5blank theme. To the point where I'm doing a fresh install of the parent theme and starting from scratch - and writing this post as I go through it! Basically upon creating the child them I now need to load my custom /css/main.css file - and it's not having it! Description of setup process follows:
I've dropped a freshly downloaded html5blank folder into /themes/ and activated it. After that I have created another folder within /themes/ called "html5blank-child". Within that I've created a new, blank style.css and functions.php.
Within style.css I have the following:
/*
Theme Name: HTML5 Blank Child
Theme URI: http://example.com/twenty-fifteen-child/
Description: HTML5 Blank Child Theme
Author: My Name
Author URI: http://myportfolio.com
Template: html5blank
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
Text Domain: html5blank-child
*/
And within functions.php I have:
<?php
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
?>
With all that done, I active my child theme. With all that done, everything still appears to be working. As I've created static templates of the website, I drop my 'img', 'css', 'font' and 'js' folders into the html5blank-child.
Now my 'actual' CSS file has a path of: html5blank-child/css/main.css
I need to load this file in. I was told to adjust my functions.php CSS path to: /css/main.css ...but it won't load the file at all. I've also tried using get_stylesheet_directory_uri() instead of get_template_directory_uri() as was advised by someone else but no luck!
The reason I've documented the process like this is, last time I got to this point if I went to access the Wordpress admin using http://localhost:8888/websitename/admin it won't redirect to wp-admin like it normally does. Also when I went to save a post, I've get a blank page. Thankfully that isn't happening this time so I guess it's a good (better) start but now I need to get my files loaded in.
Hope someone can help! :)
You need to import the style.css from main theme first inside the style.css of the child theme.
Use #import to import the css file first.
Also remove the parent-style from functions.php of child theme and then include your html5blank-child/css/main.css like the following given,
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
wp_enqueue_style( 'child-main', get_stylesheet_directory_uri() . '/css/main.css' );
}
Load the parent themes style.css first, then load your child themes CSS like this:
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-main', get_stylesheet_directory_uri() . '/css/main.css', array('parent-style') );
}
I have coruscate premium theme and I am making a child theme for it. To modify the php file I copied the file and paste it in the child theme including directory path. But it doesn't work.
I copied framework/widget.php file from parent theme and paste it to child theme folder but it didn't work.
What is the correct method of overriding the parent theme files?
You need a style.css file set up in your child theme that tells wordpress it is the child etc... then you select your child theme within admin and then things will work. See https://codex.wordpress.org/Child_Themes for more information.
For creating a child theme, make a folder inside your 'themes' folder with you child theme name. Now the child theme should have a style sheet in it which is a must. So add a style sheet and the beginning of the child theme style sheet should be as follows:
/*
Theme Name: (theme name) Child
Theme URI: (give URL)
Description: (give description)
Version: (give your version)
Author: (author name)
Author URI: (give URL)
Template: (name of parent theme)
*/
Of these the very important thing is the 'Template' which is the parent theme name. To avoid confusion take the name of parent theme from the parent theme style sheet.
Now the second thing is the functions of your child theme. Just add a php file with the name functions.php and place the below code
<?php
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
?>
It worked for me :)
I followed a very simple tutorial on how to enqueue a child theme, but when I actually went to edit my style.css nothing transferred over. Did I use the given code wrong?
style.css
/*
Theme Name: Blank Slate Child
Theme URI: http://www.efficientmind.org/blankslate-child/
*/
Enqueue code in the functions.php
<?php
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
?>
Your child theme stylesheet header needs to contain the Template line (the parent theme name) in order to work.
codex | child themes
Example:
/*
Theme Name: Twenty Thirteen Child
Theme URI: http://example.com/
Description: Child theme for the Twenty Thirteen theme
Author: Your name here
Author URI: http://example.com/about/
Template: twentythirteen
Version: 0.1.0
*/
add following comment to your child theme's style.css file:
Template: BlankSlate
your new Style.css should then look like this:
/*
Theme Name: Blank Slate Child
Theme URI: http://www.efficientmind.org/blankslate-child/
Template: BlankSlate
*/
I am having the hardest time trying to modify the woocommerce layout for the storefont template. My directory is:
Location for woocommerce plugin: wp-content/plugins/woocommerce/templates
I copy everything in the templates folder above into: wp-content/themes/storefront_child/woocommerce/
Modify any file inside the woocommerce folder above such as writing
OMG anywhere on the page.
Nothing shows in my page.
I am a rookie in WordPress and I have no idea how to modify the files for a plugin/template. I have not activated my child template either (is that required?). When I duplicate the woocommerce files and try to install them, it says the template is missing.
open up functions.php
then copy below code on there:
add_action( 'after_setup_theme', 'woocommerce_support' );
function woocommerce_support() {
add_theme_support( 'woocommerce' );
}
and then check the result
I finally got it after much research. Most sites neglect to mention that what actually "activates" the child theme is the comment in the CSS. So the child theme MUST include the CSS with the information that links it to the parent child. In my case:
/*
Theme Name: storefront-child
Theme URI: http://example.com/
Description: StoreFront
Author: John Doe
Author URI: http://example.com
Template: storefront
Version: 1.3.1
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
Text Domain: twenty-fifteen-child
*/
It seems your child theme has not configured properly. You please double check below points.
You activated Child Theme (Not the parent)
Your child theme has a style.css file with below code
/*
Theme Name: My Child Theme
Description: A Twenty Thirteen child theme
Author: My author
Template: twentythirteen
Version: 1.0.0
*/
You properly Enqueued the Styles and Scripts.
add_action( 'wp_enqueue_scripts', 'my_theme_add_stylesheet' );
function my_theme_add_stylesheet() {
wp_enqueue_style( 'my-style', get_stylesheet_directory_uri() . '/style.css', false, '1.0', 'all' );
}