header in WP Child Theme not loading consistently - css

For this site: http://kayleerosemusic.com/ I'm using this theme: https://organicthemes.com/demo/music/ -- I have customized it and made a child theme. My functions.php is:
<?php
/**
* Organic Music child theme.
*/
add_action( 'wp_enqueue_scripts', 'music_child_enqueue_styles' );
function music_child_enqueue_styles() {
wp_enqueue_style( 'music-theme-parent-style', get_template_directory_uri() . '/style.css' );
}
I have added two custom headers which randomly load. This is supported by the theme. In the parent theme, the headers load fine on the home page every time. In the child theme they do not. Sometimes they load, sometimes not and it's worse on mobile devices.
I have tried stripping out ALL the customizations and having just a blank style.css file in the child theme and I still have the issue. I can't figure out what might be causing this to happen in the child theme and not the parent theme.
My style.css in the child theme is:
#charset "UTF-8";
/*
Theme Name: Kaylee Rose
Theme URI: /wp-content/themes/kaylee-rose/
Description: Organic Music Child Theme
Author: Design Intense
Author URI: http://designintense.com
Text Domain: kaylee-rose
Template: organic-music
Version: 1.0.1
*/
Any light that can be shed on this issue would be much appreciated.

Related

How properly enqueue a child theme

I've been trying to develop a simple child theme to tweak a few things on my website which currently uses the vantage theme. So far, I've had little success.
The two files (style.css and function.php) I've created only have a few lines of code, but I'm still unable to pinpoint the problem.
<?php
add_action( 'wp_enqueue_scripts', 'enqueue_child_theme_styles',
PHP_INT_MAX);
function enqueue_child_theme_styles() {
wp_enqueue_style( 'parent-style',
get_template_directory_uri().'/style.css' );
}
?>
/*
Theme Name: vantage-child
Template: Vantage
*/
body {
color:aqua;
}
I suspect the problem is with the enqueueing in the PHP file, but all configurations that I have found on the internet and the wordpress codex don't seem to work on my site. When I activate the child theme created by my code, the site reverts to ONLY the styles in my child theme's stylesheet, instead of falling back on the parent theme's stylesheet when no styles are specified in the child theme.
For child theme you can first need to create folder with themename-child.
Then you have to create style.css file.
Put the following lines in your style.css
/*
Theme Name: Twenty Fourteen Child
Theme URI: http://yourwebsite.com/twentyfourteen-child/
Description: My first child theme, based on Twenty Fourteen
Author: Joshi Niket
Template: twentyfourteen
Text Domain: twenty-fourteen-child
*/
Then create functions.php in child theme folder and put the following 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' );
}
?>
Please check following link to make child theme with proper steps, i have added few here to guid you.ReferenceLink
Thank you ,I hope this helps you.
Please install and create child theme by using One-Click Child Theme
plugin. This is very easy to use

Customize Enfold theme on my WP site

I've to customize the header in Enfold theme of my WP site. I placed the company logo to the left and under this I placed the primary menu. I need to add another image near to the company logo. I 'created' a theme child and I would like to add a widget to place image on the right of the company logo but the theme expected in the header the company logo and the primary menu only. Can I customize my header to do this? Can you help me please? Thank's!
If you have purchased the enfold theme, you will get the child theme along with that. Your header part (menu and logo) is running from helper-main-menu.php file which is located at enfold/includes/helper-main-menu.php
Now to get this in child theme add the header.php to your child theme and then add a folder named includes and keep a copy of helper-main-menu.php. This should be as same as in parent theme.
Now you can edit your child theme files and add as many widgets you need.
I have tested and it worked for me.Happy Coding :)
I have noticed that your theme is from themeforest so you should create a child theme, then copy your header.php in child theme folder. Then make changes on that file.
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' );
}
?>
This code is for enqueuing the parent theme styles. Here you go! your child theme will work now.

Adding custom header and footer to wordpress blog

here I have a site, tinywolf.uk that i'm currently working on. The homepage is a static site separate from wordpress, but the blog part of the site http://www.tinywolf.uk/blog will be powered by wordpress.
Im currently using the twenty-fifteen theme, and would like to have the header and footer from the homepage in the blog as well for continuity.
So far I have created a child theme, and then a new header.php file which contains the header from the homepage. This replaces the existing wordpress header.php and displays correctly, however, the styling for the rest of the theme has disappeared. I want to maintain the styling for the posts.
How do I call the correct styling from the twenty-fifteen theme to ensure that the content (blog posts) are correctly styled?
here is my code for the child-theme header.php
I have tried including the style.css for the twenty-fifteen theme using <link rel="stylesheet" and although this brings up some of the formatting it also breaks the structure of the page.
here is the content of my functions.php:
<?php
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/blog/wp-content/themes/twentyfifteen/style.css' );
wp_enqueue_style( 'child-style',
get_stylesheet_directory_uri() . '/blog/wp-content/themes/twentyfifteen/style.css',
array('parent-style')
);
}
?>
and this is my child style.css:
/*
Theme Name: Tiny Theme Child
Theme URI: http://example.com/twenty-fifteen-child/
Description: Twenty Fifteen Child Theme
Author: Joel S
Author URI: http://www.tinywolf.uk/blog
Template: twentyfifteen
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: twenty-fifteen-child
*/
you have to link parent theme style.css in your child theme.
Here is a good example from codex
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
codex
If I understood true, you want to have your static page header and footer on your wp.
The only thing you need is make a copy of both parts from your static page put on separate files named header.php and footer.php then change the codes as title code to become dynamic WP codes.
After that call them into your theam.
But,
If you want using child theme do like this:
Follow all steps above and named your files as e.g. header-child.php & footer-child.php then call them like this: <?php get_header('child'); ?>
remember: header and footer must be first of your files name you cannot make like child-header.php. would not works.

Wordpress child theme white screen

Not sure what I'm doing wrong here. I started out with an ordinary custom theme and then decided to extend the twentyfifteen theme instead so I brought in the parent theme's style per the codex, and added the Template to my style.css file.
I had some custom stuff in functions.php, but even if I delete all of it except the wp_enque_style, I still get the white screen.
I have debug turned on. There aren't any errors at all. Just a white screen.
Here's my functions file:
<?php
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
wp_enqueue_style( 'twentyfifteen-style', get_template_directory_uri() . '/style.css' );
}
And my Style.css
/*
Theme Name: veochild
Theme URI:
Template: twentyfifteen
Author: veo
Author URI:
Description: Veo Child Theme
Version: 1.0
License:
License URI:
Tags:
Text Domain: veo
*/
Oddly enough, If I type in domain.local/wp-admin I am still able to access the admin site. If I change the theme to twentyfifteen it works fine. I don't have any other files in my theme directory other than functions.php and style.css and my theme folder is in the same directory as twentyfifteen.
Not really sure what else to look for.
Oddly enough, when I said:
I don't have any other files in my theme directory other than functions.php and style.css
...I lied or I must have been blind. What was also in that folder was an empty index.php file.
It took me a while before realizing that. Thanks for anyone who looked at this. Sorry for the waste of time.

Child theme not including template files of the parent in WordPress

I am creating a child theme , but my child theme in WordPress not including template files of Parent theme. I have read that all the files which are not included in Child theme are automatically imported Child theme But after activating child theme The website is displaying only header, footer and menus but not any page templates and content. Am I forgetting any step or Do I have to add some code or additional files. I am new to Wordpress.
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' );
}
?>
This code is for enqueuing the parent theme styles.
Here you go! your child theme will work now. It worked for me.

Resources