0
function elzero_add_styles(){

    wp_enqueue_style('bootstrap-css', get_template_directory_uri() .'/css/bootstrap.min.css', array(), false,  'all' );
    wp_enqueue_style('fontawesome-css', get_template_directory_uri() .'/css/font-awesome.min.css', array(), false,  'all' );
}

function elzero_add_scripts(){

    wp_enqueue_script('bootstrap-js',get_template_directory_uri() .'/js/bootstrap.min.js',array(),false,true);
    wp_enqueue_script('main-js',get_template_directory_uri() . '/js/main.js',array(),false,true);
}   

add_action( 'wp_enqueue_scripts' , 'elzero_add_styles' );
add_action( 'wp_enqueue_scripts' , 'elzero_add_scripts' );
  • 1
    Is this file even (properly) included? Also, did you debug your wordpress already? – kero Sep 21 '17 at 14:39
  • Is this in your functions.php file? Another thought - if you are working in a child theme you need to replace get_template_directory_uri with get_stylesheet_directory_uri because the template version pulls from the parent theme. – WebElaine Sep 21 '17 at 14:41
  • yes this is functions file . and i try to change to get_stylesheet_directory_uri but is still have the same problem . – Foda Sep 21 '17 at 14:44
  • ok . but why the js files didn't handle . is there any problem on this ',get_template_directory_uri()' – Foda Sep 21 '17 at 14:57
  • 1
    @Foda can you be more specific as to how it doesn't work? The files arent loaded? They 404? The includes don't appear in the header? The entire page is a white screen of death? A PHP warning/error? Please be more specific – Tom J Nowell Sep 21 '17 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.