Child Theme
Author | Posts |
---|---|
April 22, 2014 at 1:15 am 19198 | |
Larry | I created a child theme using this code below. Works fine - except none of the styles i add to it are being recognized. I saw in another thread you offered to add a script to the functions.php file - but that would defeat the purpose of a child theme - because when i update the theme it would overwrite the functions file.
Is there any method of creating a child theme? I feel like the ability to create a Child theme is a basic requirement for any wordpress themes.
|
April 22, 2014 at 6:08 am 19205 | |
Marita | Update: all other php files overwrite sucessfully as a child theme- just the css doesnt. |
April 22, 2014 at 7:07 am 19208 | |
Mahi | Make sure you put right version number of dokan theme? |
April 22, 2014 at 7:16 am 19209 | |
Marita | No i think i figured it out. The theme is coded in a way to not allow child themes to overwrite the parent style. I changed some code in function.php in the enqueue scripts section. Basically, $template_directory needed to be changed to $stylesheet_directory. By using template_directory, the child theme is still telling it to look for the parent stylesheet. See below: This solution still requires you to change the function.php file, so technically its not a true child theme. A less intrusive solution i think is just to add a customstyle.css in the header.php because when the theme is updated, all it will require you to do is add that line of code back to the header. Thoughts?
|
April 22, 2014 at 12:41 pm 19216 | |
Sk | hello Marita, you should use add action for your Thank you. |
April 23, 2014 at 8:39 pm 19301 | |
Simon | Until Wedev fixes their functions.php you’ll need to dequeue and enqueue the styles. In your child theme’s function.php you need to dequeue the style.css from the parent theme and then enqueue the style.css you have in your child theme. See code below. This assumes you have added a style.css to the root of your child theme and that the style sheet has the tag for version 1.0.3.
|
February 13, 2015 at 7:50 am 36632 | |
Gabriel | Hi, What code do I need in my child theme style.css for Simon’s code to dequeue and enqueue functions.php? In my child theme I have the following for my style.css:
I feel like I need the Version, etc…what else do I need to make Simon’s code work? Thanks! |
February 13, 2015 at 7:53 am 36633 | |
Gabriel | Could we just use this to enqueue the child theme? Or do I need to use Simon’s code to dequeue and then enqueue in functions.php in the Dokan child theme?
|
March 3, 2015 at 5:56 pm 38091 | |
Larry | This worked for me, none of the other fixes above it did… Thanks Simon
|