Hello. I am a developer and i am trying to load local .css files to my theme.
I have a custom php page and i need to load our css.
I use custom classes for our custom page, i am not changing classes like ‘row’, ‘div’ etc.
For example
.textarea.nbDescription{ min-height:27px; height:27px;}
In Chrome’s developer mode, this css is loaded but it is overridden by the css of the theme.
.textarea{ min-height:60px;}
I also tried to put my custom css with the following ways, with no result:
– wp_enqueue_styles ( using priority 1 or 999999 or PHP_INT_MAX )
– enfold-child folder in file styles.css
– under wp-admin -> appearance -> customize -> custom css
– under wp-admin -> enfold -> General styling -> Quick Css
In all the above solutions, my css is loaded but its overridden by theme’s css.
How can i load my custom css with top priority?
Thank you in advance.
Hey krkefalas,
Thank you for the inquiry.
Make sure that the custom css file depends on one of the theme css so that it is loaded after the default stylesheets. In the wp_enqueue_style, you can define the dependencies (deps) as an array of strings.
// https://developer.wordpress.org/reference/functions/wp_enqueue_style/#parameters
Try to add the shortcodes.css file as one of the deps for the custom css, handle is “avia-scs”.
wp_enqueue_style( 'my-custom-style', "path/to/custom.css", array('avia-scs'), "0.1.0, 'all' );
Make sure that the path to the css file is correct.
Best regards,
Ismael
Thank you!!!
It works.
WeI used array(‘avia-scs’, ‘avia-merged-styles’) because we want to work also if the switch “compress for performance” is enabled.
Hi,
Did you need additional help with this topic or shall we close?
Best regards,
Jordan Shannon
Problem fixed.
Please close this ticket.
Hi krkefalas,
We’re glad to hear that :)
Thanks for using Enfold and have a great day!
Best regards,
Nikko