Reputation: 235
I've semi-successfully created a wordpress child-theme. By successfully I mean:
However, there is one huge problem:
I know the "information header" must be ok since I was able to see/activate the child-theme. But I really can't figure out what is wrong. I tried removing the @import rule, which according to the Wordpress codex should remove all styles from my site - nothing happened.
I'm using the Panorama theme and created "panorama-technology" as a child. Below you can see the code I have in the style.css file inside the child-theme: "panorama-technology":
/*
Theme Name: panorama-technology
Template: panorama
*/
@import url("../panorama/style.css");
#search{
margin: 15px 15px 0 0;
}
Upvotes: 1
Views: 16520
Reputation: 4869
Do not use import.
Add time after css uri for refreshing everytime.
In your function.php
function child_style() {
wp_enqueue_style( 'parent-child', get_stylesheet_uri().'?'.time());
}
add_action( 'wp_enqueue_scripts', 'child_style', 20 );
Upvotes: 1
Reputation: 18734
Watch out from caching :
wp cache plug-ins
server side cache (APC etc.)
local browser cache
Upvotes: 0
Reputation: 101
WouterB, I had the same problem with my child theme loading in the backend, and child php pages overriding the parent theme php pages, but NO child CSS changes loading to override the parent styles.
So,although with different coding, it turns out my parent theme was written in such a way that the header was also looking for the stylesheet in the template directory, so your solution was spot on in concept.
Thus, by changing the call in the header from :
<link rel="stylesheet" type="text/css"
href="<?php echo get_template_directory_uri();?>/style.css" />
to:
<link rel="stylesheet" type="text/css"
href="<?php echo get_stylesheet_directory_uri();?>/style.css" />
--did the trick like magic. At least as far as I can tell so far.
You get major credit in my book!
Upvotes: 10
Reputation: 614
First I'd try an absolute path to be sure that the path isn't the problem. If that does not solve the issue. Place the @import at the very top of the css file or directly after thelast "*/". I think white space is probably the culprit here.
Upvotes: 1