Correct code in functions.php for style.css
Author | Posts |
---|---|
April 23, 2014 at 5:40 am 19259 | |
Marita | I've seen this mentioned in another thread, but can you please update line 269 in the functions.php file.
Change from:
wp_enqueue_style( 'style', $template_directory . '/style.css', false, null );
Change to:
wp_enqueue_style( 'dokan-stylesheet', get_stylesheet_uri(), array(), '1.0.3', 'all');
This makes it easy to create a child theme, which will have a style.css to override the style.css in the parent dokan theme.
All that has to be at the top of the child theme's style.css is:
Then only the version number needs to be updated in the parent style.css, the child style.css, and the functions file when updating Dokan.
|
April 23, 2014 at 3:05 pm 19278 | |
Tareq Hasan | Hello Simon, Thanks for the post. Although we are not using |
April 23, 2014 at 6:21 pm 19294 | |
Simon | Hi Tareq, Technically you are using the main style.css as it’s required by WordPress. Just because you’ve decided to add additional stylesheets does not mean that style.css is not enqueued — as can be seen on line 269 of your functions.php. Please see this page: https://codex.wordpress.org/Function_Reference/get_stylesheet_directory_uri As a workaround, I’ve already dequeued line 269 in my child theme’s function.php file, but there is no need for this if you could make the simple fix. This will make it easier for you, and others, to create their child theme. Here’s what I’m currently doing in the functions.php in my child-theme.
|
April 23, 2014 at 8:55 pm 19302 | |
Simon | Additional details on how child themes work. https://codex.wordpress.org/Child_Themes |
April 25, 2014 at 2:47 am 19360 | |
Marita | Simon i agree that changing the functions.php to make child theme support standard can easily be done – but i find this just as easy to create a functions.php in my child theme and add this code. All that its doing is loading the style.css from my child theme as the last style in the wp_enqueue_scripts function.
|