• Resolved harman79

    (@harman79)


    Hi all,

    I really need some help with how to correctly enqueue the various styles in the kadence theme.

    I want all css inside main theme directory to be loaded first, all css generated via back panel options to be loaded second and all css that I add in my child theme to be loaded last and thus be the most important.

    How do I work around this? Do I first have to deregister all styles, re-register them, and then correctly enqueue them in my functions css? How do i do that for the css generated via back-panel options?

    Thanks
    Harry

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi,
    hmm, You can’t really do that. The css generated by the theme options is php and not enqueued. but there is a workaround, You could use this function to make the child css load after the theme options.

    function kadence_child_scripts() {
    	wp_dequeue_style('kadence_child');
    }
    add_action('wp_enqueue_scripts', 'kadence_child_scripts', 101);
    function kadence_child_add() {
    	echo '<link rel="stylesheet" id="kadence_child_after-css" href="'.get_stylesheet_uri().'" type="text/css" media="all">';
    }
    add_action('wp_head', 'kadence_child_add', 250);

    Out of curiosity? Why override the theme options? Why not just change them to what you want? Or make your child theme have a deeper css selection.

    Kadence Themes

    Thread Starter harman79

    (@harman79)

    Hi,

    thanks very much for your reply. Your suggestion worked like a charm and I can now farewell the numerous silly !importants from my css.

    To answer your question, the site I am developing is fullscreen and heavily backgrounded. Therefore I had to stack backgrounds one on top of the other for the various divs of the theme (body, footer, header) so that it looks nice at all resolutions. Expectedly, your awesome theme does not offer such option. I mean, that would be an overkill..

    Thanks once again guys. Your support team is one the best support teams out there.

    Harry

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Correctly Enqueue Stylesheets’ is closed to new replies.