Jump to content

Archived

This topic is now archived and is closed to further replies.

ketri

How to load an external css-stylesheet from the child-theme directory after the main style.css using functions.php?

Recommended Posts

ketri

I use codekit when developing sites because it's a lot better for handling Less with auto-refresh, bug reports, ability to use a decent text-editor.
So basically I'm overriding the less from the main style.css and combine them together later when work is done.

 

Here is the code in my functions.php

 

function high_priority_style() {
  Wp_enqueue_style('important', get_stylesheet_directory_uri() . '/wp-pohja-codekit/codekit.css');
}
add_action('wp_enqueue_scripts', 'high_priority_style', '999');

Still it's loading right before the main style.css

How can I load an external .css after the main style.css using functions.php?

Thanks!

Share this post


Link to post
Share on other sites
Danny

Hi,

 

I remember replying to a topic you wrote on this subject already - http://forum.pagelines.com/topic/32753-how-should-i-proceed-if-i-want-to-covnert-less-css-by-myself-ie-with-codekit/?hl=codekit

 

Not sure why you mention bug reports, bug reports for what and why you're using Codekit to do something that DMS already does for you ?

 

The best code editor our there is SubLime Text, some may argue for TextMate, Atom.io or elites will say Vim.

 

There are already live preview browser plugins or applications already and I am positive this can be achieved with SubLime Text too. There are also Lint packages that you can install which will inform you if you have made any errors in your code.

 

So I really don't see the benefit of using CodeKit, DMS compiles it already for you. Especially, as the built in editor already provides Live Preview.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
ketri

Maybe I'm missing something, no need to argue :)
I'd still like to know how can I achieve loading an external stylesheet after the main style.css.

Thanks!

Share this post


Link to post
Share on other sites
Simon

999 is the lowest possible priority 1 is highest.

Share this post


Link to post
Share on other sites
ketri

Danny

I made a quick video where I try to explain my situation better: 

https://www.youtube.com/watch?v=ty64wCn7OLw


The custom Less form in DMS front end:
- no auto-complete

- no snippets

- no version control

- no cmd+tabbing to go between text editor and browser

- its a small space if there is lots of less

- etc

+ live preview is nice! 

So even though I think this is a good design and totally respect it, it just won't cut it for me if I write more than a few lines. So this wont's do.

 

Child-themes style.less -file and refreshing
- slooooooooow
- Needs to refresh and deal with cached Less-files so changes won't show every time

 

Codekit:
+ fast
+ does not need even refreshing because of css-injection

+ can open the site in mobile devices and see changes change there also without refreshing

+ If I have bugs, it tells on what line they're on etcetc

- one more http-request because of another stylesheet but I can combine them later or not worry about it


So for these reasons I need to get my own .css -file in the head after the main style.css

Thanks!

Share this post


Link to post
Share on other sites
ketri

Danny
Could I please get a little bit of help here =) 
I still cannot get the .css -file to load after the main style.css. 
I tried using different header hooks but for some reason the .css file ends up outside the <head>...

Share this post


Link to post
Share on other sites
Simon

this works:

 

https://gist.github.com/Pross/c019166586e40b19a769

Share this post


Link to post
Share on other sites
ketri

Thanks for your reply Simon_P

Unfortunately it's still adding the stylesheet just before the main DMS style.css. I think I also tried a similar solution I found from stackoverflow. 

https://www.dropbox.com/s/m79bm8k41h08ud7/Screenshot%202014-05-22%2014.58.37.png

I wonder why is that? I'd assume that someone who knows DMS inside out would know how the main stylesheet gets loaded and how can we load something after it.

Thanks!

Share this post


Link to post
Share on other sites
Simon

change 11 to something higher.

Share this post


Link to post
Share on other sites
ketri

I tried 100, 999, 9999 but unfortunately it's always just before the main style.css

Share this post


Link to post
Share on other sites
Simon

try this

 

https://gist.github.com/Pross/c019166586e40b19a769

Share this post


Link to post
Share on other sites
ketri

Yes!
Thank you very much for taking the time to help me with this one Simon_P! :) 

Share this post


Link to post
Share on other sites

  • Similar Content

    • chamois_blanc
      By chamois_blanc+
      Hello,
      Shouldn't the image PL5 component be using the srcset/picture css directives to pick the correct size for an image? or it does already and I don't know how to use it? Thank you for any advice or enlightenment.
    • Dan Haddock
      By Dan Haddock
      Plugins Active and installed: 
      Akismet Anti-Spam
      Coming Soon Page & Maintenance Mode by SeedProd
      Contact Form 7
      Cookie Law Info
      DMS Professional Tools  
      Enhanced Media Library  
      Flamingo
      Google Analytics for WordPress by MonsterInsights
      Google XML Sitemap
      Jetpack by WordPress.com
      Legull 
      Loginizer   
      MailChimp for WordPress
      PageLines Updater    
      Schema App Structured Data 
      Sucuri Security - Auditing, Malware Scanner and Hardening
      Uber reCaptcha    
      Yoast SEO
      Wordpress Version: 4.8.1
      Pagelines Version: 2.2.4
       
      Good Evening/Afternoon or Morning, 
      I am running into a problem with CSS styling not applying inside of most browsers (Safari, Firefox) when I am logged in to wordpress, and all browsers that I have tested when I am logged off and the site has been made public (Chrome, Firefox and Safari).
      As a result, I have managed to identify the probable cause. It looks as though these browsers are refusing to render my sites compiled CSS file due to it being a HTTP URL rather than HTTPS.
      I have attempted to change this URL to HTTPS in my browser, however it brings back an ERROR: File not found page - https://www.shortfilmblog.com/wp-content/uploads/pagelines/compiled-css-core-1505847507.css
      What would you suggest in this regard? Would this be resolvable from your end?
      Happy to provide any further details required.
    • Borries
      By Borries+
      I know this is not an easy problem. Maybe there is a easy solution.
      I have tryed to uses the existing solution, that I have found in the forum
      I changed the colours of my nav (simple nav) and the hover effect (a. hover).
      I really tryed to highlight the active/used link in the nav but I cant figure it out.
      I want it to be black when active.
      Any help would be appreciated. Thanks.
      http://www.marcborries.de  nav link: "Sinn & Selbst" 
    • Barnaby Skinner
      By Barnaby Skinner+
      Hey all, hope I worded the topic correctly!
      I just need to know if either 1) I'm making a mistake or 2) this could be set as a new feature?
      Using the global settings typography parameters, I have a global paragraph font type (set using googlefonts) and have set the style to align:justify. When laying out <p> text inside a simple TEXT module, the <p> text adheres to both the font type and justification. Perfect.
      Now, when I set <p> text inside the PARAGRAPH TEXT field within an ELEMENT module, the <p> text adheres to the font type, but not the justification. It's rather annoying as I like to fully justify para text across the board and tend to use Element modules instead of text boxes for various reasons. It also seems silly that some PARAGRAPH TEXT fields adopt global settings, whilst other don't.
      Or I'm doing it wrong :S
      Any help or advice is much appreciated!
      Cheers
    • Michael Kummer
      By Michael Kummer+
      Hi guys,
      every since Chrome introduce scroll anchoring (see chrome://flags) blog posts on my page start scroll automatically as soon as the user scrolls down a bit. It is super annoying and I don't know exactly what triggers the incompatibility with Chrome's latest feature that is supposed to improve usability.
      Since I don't know what causes it (Pagelines, or a Plugin), I would like to disable the feature using a CSS override that Google describes as follow:
      "Scroll anchoring aims to be the default mode of behavior when launched, so that users benefit from it even on legacy content. A CSS property overflow-anchor can disable scroll anchoring in part or all of a webpage (opt out), or exclude portions of the DOM from the anchor node selection algorithm. This property supports the following values when applied to an element E:
      overflow-anchor: auto (the default value) declares that the DOM subtree rooted at E is eligible to participate in the anchor node selection algorithm for any scrolling box created by E or an ancestor of E. overflow-anchor: none declares that the DOM subtree rooted at E is not eligible to participate in the anchor node selection algorithm for any scrolling box created by E or an ancestor of E." Do you guys happen to know how to use that property with the ROOT element so it applies to the whole page?
      Thanks
      Michael 
×