Load Get JS Files On Header

<?php 

function load_custom_css_and_js_files(){

    //Load JavaScript Files

    //If No JavaScript dependecies load with NULL
    //wp_enqueue_script('custom_js', get_theme_file_uri('/build/index.js'), NULL);

    //If JavaScript dependecies exist load them like this. this case using jQuery
    wp_enqueue_script('custom_js', get_theme_file_uri('/build/index.js'), array('jquery'), '1.0', true);

IMPORTANT NOTICE array('jquery'), '1.0', true); TRUE means script will load on bottom of page before </body>

    //This would get primary theme style.css    
    //wp_enqueue_style('custom_main_styles', get_stylesheet_uri());

    //Fetch Custom css hosted and cdn files. Notice how to import cdn
    wp_enqueue_style('custom-google-fonts', '//fonts.googleapis.com/css?family=Roboto+Condensed:300,300i,400,400i,700,700i|Roboto:100,300,400,400i,700,700i');
    wp_enqueue_style('custom_font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css');
    wp_enqueue_style('custom_main_styles', get_theme_file_uri('/build/style-index.css'));
    wp_enqueue_style('custom_extra_styles', get_theme_file_uri('/build/index.css'));

}

add_action('wp_enqueue_scripts', 'load_custom_css_and_js_files');
Scroll to Top