I'm wondering if someone can help me with this. The theme I am working on has a custom theme options page where you can select various colors for the website. The problem is that the stylesheet it produces loads before the bootstrap and main stylesheet in header.php. I need this to load after those two. Is this possible to do?
-
Have you read about stylesheet dependencies (another explanation)?– fuxia ♦Aug 22, 2014 at 18:54
-
Doesn't work for me. I think it's because the various color stylesheets are being enqueued from my theme-options.php file instead of the functions.php file.– user1181153Aug 22, 2014 at 20:44
1 Answer
Found a solution. I just added a number at the end like this..
add_action( 'wp_enqueue_scripts', 'moana_enqueue_color_scheme', 789 );
-
2That'll work too, as that number is actually the priority in which the callbacks are rendered in an action hook. But, you'll need to create separate callbacks for each of your stylesheets and use priorities accordingly. The best way is using the stylesheet dependencies, which gives you much more control over the enqueued scripts and stylesheets.– AbhikOct 23, 2015 at 5:38