第一次尝试在 Wordpress 中注册和排队样式和脚本,但无法弄清楚为什么它不起作用



第一次尝试在Wordpress中注册和排队样式和脚本,但无法弄清楚为什么它不起作用。

知道我可能做错了什么吗?这是我的函数.php文件:

<?php
function add_theme_scripts() {
    wp_register_style( 'bootstrap.min',  get_template_directory_uri() .'/css/bootstrap.min.css');
    wp_register_script( 'bootstrap.min-js',  get_template_directory_uri() .'/css/bootstrap.min.js');
    wp_register_script( 'script',  get_template_directory_uri() .'/css/script.js');
    wp_register_script( 'jquery-3.1.1',  get_template_directory_uri() .'/css/jquery-3.1.1.js');
    wp_enqueue_style( 'bootstrap.min' );
    wp_enqueue_script( 'bootstrap.min-js' );
    wp_enqueue_script( 'script' );
    wp_enqueue_script( 'jquery-3.1.1' );
    }
add_action( 'wp_enqueue_scripts', 'add_theme_scripts' );
?>

这是我的标题.php文件:

<!DOCTYPE html>
<html <?php language_attributes(); ?> class="no-js no-svg">
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" />
<link rel="profile" href="http://gmpg.org/xfn/11">
<?php wp_head(); ?>
</head>

谢谢大家!

原来这是一件非常愚蠢的事情...我工作的FTP中有一个重复的文件系统...所以根本不与代码相关:/

我很欣赏答案:)再次感谢。

我认为问题出在句柄上,bootstrap.min您需要通过替换 .(点)从它。请改用 -(连字符)。

相关内容

最新更新