New Landing How can we help? Cardinal Cardinal: Child theme CSS vs Admin custom CSS

Viewing 15 posts - 16 through 30 (of 30 total)
  • Posted in: Cardinal
  • #127117
    FlawlessWeb
    Member
    Post count: 542

    I found this link:

    WooCommerce & Genesis: An !Important Style Tip For You

    Would it be possible to add a code snippet that would load the child theme css after the customizer and custom css outputs in the header?

    In theory that should solve a lot of my issues or would it?

    #127119
    FlawlessWeb
    Member
    Post count: 542

    Didn’t see that reply. I’ll try that how.

    #127123
    FlawlessWeb
    Member
    Post count: 542

    Tried this with no luck unfortunately.

    Using your code it loads the stylesheet just below responsive.css.

    So that means WooCoommerce, customizer code, custom css etc is all loaded after it.

    For testing, I changed the snippet from 100 to 1000 and it made little difference… just moved it down a few lines below redux-google-fonts-css

    Any ideas?

    #127126
    Swift Ideas – Ed
    Keymaster
    Post count: 15264

    Try with 15, like in that article?

    – Ed

    #127127
    FlawlessWeb
    Member
    Post count: 542

    No use, 15 loads the stylesheet even higher up in the header.

    #127159
    Swift Ideas – Ed
    Keymaster
    Post count: 15264

    Hmm, annoying. Had a quick google and found this, give it a try:

    add_action('wp_head','AB_late_css',1);
    function AB_late_css(){
    	$source = get_stylesheet_directory_uri().'/adjust_ABplugins.css';
    	wp_enqueue_style('adjust_ABplugins', $source);
    }
    

    – Ed

    #127162
    FlawlessWeb
    Member
    Post count: 542

    Tried that and doesn’t seem to do anything.

    #127377
    Swift Ideas – Ed
    Keymaster
    Post count: 15264

    Hmm ok.. The best way which I can think to do it is to do the first way I provided, and then use a plugin such as Better WordPress minify to adjust the order – but I’m guessing since you are running user sites that this isn’t too ideal?

    I’ll keep looking.

    – Ed

    #127378
    FlawlessWeb
    Member
    Post count: 542

    Hey Ed,

    No that wouldn’t be ideal for two reasons. The first as you said is that it would be running on user sites and the second one is that I am planning on using w3totalcache and from my testing, BWM does not work too well with that and/or is unncessary as W3 does BWM job anyway.

    Hope you can find a solution. Working with a child theme is so convenient when dealing with a lot of code.

    Thanks.

    #127421
    Swift Ideas – Ed
    Keymaster
    Post count: 15264

    Ok just tested this and it output below the custom css:

    function custom_style_sheet() {
    	wp_enqueue_style( 'custom-styling', get_stylesheet_directory_uri() . '/test.css' );
    }
    add_action('wp_head', 'custom_style_sheet');

    – Ed

    #127466
    FlawlessWeb
    Member
    Post count: 542

    Thanks Ed,

    I’ll try it out when I’m back at the computer.

    #127469
    FlawlessWeb
    Member
    Post count: 542

    Just tested it, doesn’t work for me.

    That code loads the custom css stylesheet in the footer and not before the closing </head>…

    #127474
    Swift Ideas – Ed
    Keymaster
    Post count: 15264

    Ahh yeah, that is odd.. Ok, this definitely works 100%.

    function custom_style_sheet() {
    	    echo '<link rel="stylesheet" href="'.get_stylesheet_directory_uri() . '/test.css'.'" type="text/css" media="all" />';
    }
    add_action('wp_head', 'custom_style_sheet', 100);
    #127528
    FlawlessWeb
    Member
    Post count: 542

    Seems to have done the trick.

    Thanks Ed.

    #127535
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Great, thanks Ed

Viewing 15 posts - 16 through 30 (of 30 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register