WordPress.org

Support

Support » Themes and Templates » Hueman » Move all JS to bottom and all CSS to TOP

Move all JS to bottom and all CSS to TOP

  • Hello.
    Your theme is great. I really like it for my purpose but i’m wondering how can i move all CSS to top loading and all JS to load on the bottom of the page ?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi! Thank you.

    The theme CSS should be loading in the head of the theme, you can see the enqueued css files in functions.php.

    As for the javascript, it’s a good idea to load flexslider.js in head for optimal loading speed. All the other theme javascript is loaded in the footer.

    Hello Alexander.

    Thanks for the reply.

    Yes all my CSS are loaded in the head section but also i dont want to use the slider the slider is currently disabled and i dont wanna load the flexslider.js.

    In the head i also have 3 js loading.

    wp-includes/js/jquery/jquery.js
    wp-includes/js/jquery/jquery-migrate.min.js
    wp-content/themes/hueman/js/jquery.flexslider.min.js

    I’m not sure does the js are from the theme ?

    So is there any chance to get rid of the slider and to load the jquery.js and jquery-migrate.min.js in the footer ?

    Thanks

    In functions.php, flexslider is loaded with:

    wp_enqueue_script( 'flexslider', get_template_directory_uri() . '/js/jquery.flexslider.min.js', array( 'jquery' ),'', false );

    You’d remove that by copying over the alx_script function to a child theme and remove that line. See more in theme options > help dropdown in the “child theme” section to see how to do.

    As for the jquery, that is loaded with WordPress standard functionality so I’m not quite sure how to move that down below. It is usually recommended to keep it up top as it needs to load first of the js scripts.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Move all JS to bottom and all CSS to TOP’ is closed to new replies.
Skip to toolbar