I'm writing a simple wordpress theme. I've added this function inside the functions.php file and I've noticed that only style.css is loaded. Is there something wrong that will cause that the other scripts aren't loaded?
function load_theme_assets()
{
//wp_register_style( $handle:string, $src:string|false, $deps:array, $ver:string|boolean|null, $media:string )
wp_register_style(
'main',
get_template_directory_uri() . '/style.css',
false
);
wp_enqueue_style('main');
//wp_register_script( $handle:string, $src:string|false, $deps:array, $ver:string|boolean|null, $in_footer:boolean )
wp_register_script(
'main',
get_template_directory_uri() . '/index.js',
[],
false,
);
wp_enqueue_script('main');
wp_register_style(
'bootstrap',
'https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css',
false
);
wp_enqueue_style('bootstrap');
}
add_action('wp_enqueue_scripts', 'load_theme_assets');
?>
get_header()andget_footer()functions and only the style.css is loadedwp_head()andwp_footer()inside of the header and footer?get_template_directory_uri() . '/index.js'(i.e. the path is correct and that it exists)?