-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
custom css not working in style.css #48
Comments
i found this solution : define( 'HELLO_ELEMENTOR_CHILD_VERSION', '2.0.0' ); change version number at the end for example change it to 2.0.1 complement : |
as a better solution for development time , add this : ?v='.time() after the style.css file name like this : get_stylesheet_directory_uri() . '/style.css?v=' .time() , this is complete code you need to replace with the style load function in child theme function.php :
Explanation: Don't forget to remove it after your done developing otherwise your caching won't work for this file and it would load for returning users again and again. |
Hi there, Thanks for the effort Milad. We have the same issue as ollyvision, but unfortunately your advice of changing the version number doesn't work for us. Even if what you said works, it shouldn't be considered a solution, but a workaround instead. Only applying the style.css file whenever a version number in a different file is changed, doesn't sound like a good practice to me. Anyway, I'm new to reporting issues on GitHub. What will happen after the issue is reported? Will a developer look at the issue and either fix it or provide a functional workaround? Is the style.css file supposed to work this way or is it an issue? |
This has to do with how your browser interacts with the cache and how the elementor child theme enqueues the style.css file. For me, what worked was creating a function in functions.php that tracks the CSS version and appends it every time the browser calls it, so every time you change your style.css, make sure you update the version number and save it; then refresh your browser. Using this workaround makes your browser look for the new CSS file version every time and actually show changes:
Another option (that I haven't tried) is using more modern development tools like grunt, linting, etc. |
Thanks for the reply, and here there is nothing wrong with the developer , |
Hello @Milad-jfr , I'm dealing with the same issue, and Googling takes me here. I've implemented the versioning of the CSS child theme file. The appended part, with the time of creation/updated file, is inserted correctly at the end of the file. But when I change the CSS child file, I need to use a hard refresh in the browser (i.e. CTRL + F5) - after that the time of updating of file is updated. I don't use any caching tool - only Elementor itself. Couldn't be there connection with some performance/cache option in Elementor itself? Result: behaviour is like before - always need to use CTRL + F5 to load updated CSS in child theme. Thank you for your help |
I've tried the above to no avail. add_action('wp_enqueue_scripts', function() {
$parent_style = 'hello-elementor-theme-style';
wp_enqueue_style($parent_style, get_template_directory_uri() . '/style.css');
wp_enqueue_style('hello-elementor-child-style',
get_stylesheet_directory_uri() . '/style.css',
[$parent_style],
wp_get_theme()->get('Version')
);
}, 100); This theme is seriously broken, and it should be fixed. |
Even I am facing the same isue , I have tried all possible solution. |
Hello
I have a fresh install of wordpress, with elementor pro and hello with hello child theme.
When i add any custom css to the style.css it does'nt change anything on the website, but if i add it to a elementor css custom box then it works. I've tried turning off the few plugins i have on, off and nothing changes. Also no caching plugin is running.
is there something i need to do to make the style.css work? It appears in wordpress file editor but ive tried adding via that method and just editing the file and uploading via ftp, but no difference.
Thanks
The text was updated successfully, but these errors were encountered: