- This topic has 7 replies, 3 voices, and was last updated 4 years ago by
David.
-
AuthorPosts
-
March 14, 2019 at 2:33 pm #839238
Hubner TANGUY
Hello GP Team,
I’m trying to use custom CSS through the child theme (style.css), but it does not work. I would be grateful if you could help me with that.
It’s a bit strange as when I have the code in the “Customizing: Additional CSS” area, everything is working fine; but if I move it to my child theme, nothing is taken into consideration.
The other files, e.g. function.php customization in the child theme, works.
I have read the other topics in here, and the guides at https://docs.generatepress.com/article/using-child-theme/ and https://docs.generatepress.com/article/child-theme-issues/, but I don’t manage to understand what could be wrong (I have no @import or enqueuing there).
If it’s from any help, here is my current custom CSS (which works from the customizer, but not from the style.css child theme):
div.us_excerpts_bottom { display: none; } /* hide category name and description */ .archive .page-header { display: none; } .main-navigation .resources { background-color: #b69823; } /* add custom sticky badge to pinned post */ .blog .post.sticky { position: relative; } .blog .post.sticky:before { content: url("https://howtogetref.com/wp-content/uploads/2019/03/stickypost-wpfont.png"); position: absolute; top: 0; left: 1px; }
And here is the current function PHP file in the child theme (working fine):
<?php /** * GeneratePress child theme functions and definitions. * * Add your custom PHP in this file. * Only edit this file if you have direct access to it on your server (to fix errors if they happen). */ // Disable Admin Bar add_filter('show_admin_bar', '__return_false'); // Function to return user count and shortcode for it function wpb_user_count() { $usercount = count_users(); $result = $usercount['total_users']; return $result; } add_shortcode('user_count', 'wpb_user_count');
Thanks in advance,
Tanguy H.GeneratePress 2.2.2GP Premium 1.7.8March 14, 2019 at 4:45 pm #839299Tom
Lead DeveloperLead DeveloperHi there,
Any chance you can add some CSS to the child theme so I can check why it’s not working?
Let me know π
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMarch 15, 2019 at 2:10 am #839496Hubner TANGUY
Hello Tom,
Yes, I just moved some of the CSS from the customizer to the style.css child theme:
.main-navigation .resources { background-color: #b69823; }
(which is supposed to make the “resources” button in the menu turn yellow, but this only works when it’s in the customizer).
Let me know if that helps to debug the issue.
Thanks in advance π
Tanguy H.March 15, 2019 at 4:52 am #839606David
StaffCustomer SupportHi there,
can you double check that the stylesheet saved with that CSS as currently i am seeing an empty style sheet? Maybe try clearing server caches if the problem still persists.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 15, 2019 at 5:06 am #839627Hubner TANGUY
Hello David,
I checked and everything is fine (it was maybe the cache).
But I progressed in understanding my issue:
if I exclude the “.css” extension from my CDN (the plugin is “CDN Enabler”, and I use KeyCDN).
The CSS code from my child theme style.css is then working…It’s less related to GeneratePress than I thought, it seems. But if you have any idea about the reason and how to solve that (without excluding .css from CDN) it would be appreciated π
Thank you,
Tanguy H.March 15, 2019 at 5:14 am #839636David
StaffCustomer SupportI am not that well informed with CDN enabler. I know CDNs can take a while to propagate changes and they can also grab cached files. Might be worth asking the plugin author π
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 15, 2019 at 5:40 am #839667Hubner TANGUY
Alright, I will explore that with them. Thank you.
Enjoy your day,
Tanguy H.March 15, 2019 at 5:50 am #839675David
StaffCustomer SupportYou’re welcome. You too
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.