-
AuthorPosts
-
May 9, 2021 at 9:16 am #1299157
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 CssIn 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.May 11, 2021 at 9:48 am #1299617Hey 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,
IsmaelMay 15, 2021 at 5:27 pm #1300492Thank 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.
May 17, 2021 at 4:36 am #1300632Hi,
Did you need additional help with this topic or shall we close?
Best regards,
Jordan ShannonMay 17, 2021 at 11:27 am #1300688Problem fixed.
Please close this ticket.May 17, 2021 at 12:50 pm #1300716Hi krkefalas,
We’re glad to hear that :)
Thanks for using Enfold and have a great day!Best regards,
Nikko -
AuthorPosts
- The topic ‘Custom CSS on external files not loaded with max priority’ is closed to new replies.
