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    7
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    1,327
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    7
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    247
Simon

999 is the lowest possible priority 1 is highest.

Share this post


Link to post
Share on other sites
ketri    7
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    7
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    247
Simon

this works:

 

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

Share this post


Link to post
Share on other sites
ketri    7
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    247
Simon

change 11 to something higher.

Share this post


Link to post
Share on other sites
ketri    7
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    247
Simon

try this

 

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

  • Like 1

Share this post


Link to post
Share on other sites
ketri    7
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

    • 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 
    • wyo22ski
      By wyo22ski+
      Hello,
       
      I'm basically a designer and understand a little on how to change CSS, etc., so please excuse my ignorance...  I recently upgraded to the newest platform from the DMS and my old DMS theme no longer functions.  I'm trying to replace the image slider that my Horizon Photography Theme (Nick Haskins) had created.  The Impulse image slider seemed the closest to what I need, but there are problems.
      It seems the the Impulse section for sliding images defaults to the image width, no the height.  I can change the Impulse stage height and width, but this does nothing to the internal content.  For instance, if I change the height to 200 pixels, the image remains the full width and only shows a cropped section.  I would like the ability to change the Impulse height, and have the image height fit space. 
      I've put this custom CSS in, but again, this only controls the stage height of Impulse:
      .pl-sn-impulse .pl-impulse-cell .cell-wrap, .pl-impulse-container, .owl-stage-outer {
        width: 100%;
      }
       
      Any suggestions welcome.  Thanks 
    • Objectif-Mariage
      By Objectif-Mariage+
      Hello. 
      I have just realized that CSS (Less plugin) , is not working..... I have disable all plugins (except PL CUSTOM LESS and PL5) , and ... it's not working ... 
      It's not the first time. Usually I had trouble with a plugin name Autoptimize , but it's Desactivate now , all memory have been purge, and it's still not working! :-/ So it's not from this plugin. 
      NB : When I am logged on my website, if i go on the black wordpress dashboard bar, go on the PL icon, clic on </> LESS/CSS => then the page suddenly apply the CSS .... But As soon that i reload the page, nothing. I think the problem is that the plugin LESS/CSS does not load properly (if I can say that with my simples words).
      I order to keep the site "good looking" I have temporally copy/paste all my LESS code in a plugin : Script n Styles that apply the LESS/CSS code... but it's not a solution for long time.
      Can someone help me ? Did I do something wrong ? Is it an update ? 
       
      my website : https://www.wedding-photography-minneapolis.com
    • Jason
      By Jason+
      Feel free to delete this post if its not helpful or its just plain wrong.
       
      I though it might be useful to share how I customize the size of the builder. (reduce my eyestrain )
      1 - install stylerbot extension in chrome (stylerbot keeps this css every time you access the url)
       
      2- add this css to stylerbot for the site you are working on
      .CodeMirror {
          font-size: 14px;
          height: 600px;
      }
      .pl-workarea.pl-has-sidebar .pl-workarea-sidebar-container {
          right: 0px;
          width: 500px;
      }
      .pl-workarea.pl-has-sidebar .iframe-container {
          right: 500px ;
      }
       
      change sizes to suit.
       
      Cheers.
×