• Hello,

    I am trying to get my CSS files to load after the theme and plugins have been loaded using add_action(after_setup_theme, add_css_js, 100000)

    function add_css_js(){
    wp_enqueue_style('gem', trailingslashit(get_theme_root_uri()) . 'gemtechllc/css/gem.css');
    
    wp_enqueue_script('js_file',trailingslashit(get_theme_root_uri()) . 'gemtechllc/js/gem.js',false);
    }
    add_action( 'after_setup_theme', 'add_css_js', 0);

    Please advise.

    Thank you,

    Don

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • the wp_enqueue_style would determine where it would install. There isn’t an option to load last. But, there is a dependent options which is an array. If you add the style-sheets you want to it to load after in the array. It will be placed after them.

    Here the documentation for enqueue_style

    Sorry looked at the question wrong. You could try wp_loaded which would fire after the theme has completely loaded. I’m not sure if it will work.

    Why do you want the css to be added so late.

    Thread Starter dsdoyle

    (@dsdoyle)

    Hi,

    That worked! Thank you very much!

    The reason I want this done is because one of the plugin CSS files were loading after and therefore overriding my files.

    Thanks again!

    Don

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Trying to get my CSS files to load last using add_action’ is closed to new replies.