why wp_enqueue_scripts() not working?
-
21-04-2021 - |
Domanda
here is code
function custom_theme_script(){
wp_register_style('bootstrap', get_template_directory_uri() . '/css/bootstrap.css' );
wp_enqueue_style('bootstrap');
wp_register_style('style', get_template_directory_uri() . '/css/style.css');
wp_enqueue_style('style');
wp_deregister_script( 'jquery' );
wp_enqueue_script('bootstrap.min', get_template_directory_uri() . '/js/bootstrap.min.js', array(), '3.5.1', true );
}
add_action('wp_enqueue_scripts', 'custom_theme_script');`
this is screenshot of head tag
what is missing in header.php and functions.php file
Soluzione
Hey bro Use this code get_stylesheet_directory_uri
function custom_theme_script(){
wp_register_style('bootstrap', get_stylesheet_directory_uri.() .'/css/bootstrap.css' );
wp_enqueue_style('bootstrap');
wp_register_style('style', get_stylesheet_directory_uri() . '/css/style.css');
wp_enqueue_style('style');
wp_deregister_script( 'jquery' );
wp_enqueue_script('bootstrap.min', get_template_directory_uri() . '/js/bootstrap.min.js', array(), '3.5.1', true );
}
add_action('wp_enqueue_scripts', 'custom_theme_script');
`
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a wordpress.stackexchange