【发布时间】:2020-07-10 13:59:54
【问题描述】:
我目前正在尝试在 wordpress 中创建导航栏。
但是,当导航栏折叠并且汉堡图标仍然存在时,导航栏不会展开。
我查看了 Chrome 开发工具并尝试使用 $(),但它显示未定义,这让我认为 jquery 没有加载,但是我将它排在 functions.php 中
我有点困惑,不胜感激。
我的代码:
<?php
function enqueue_kraken_theme(){
//style
wp_enqueue_style(
"style",
get_template_directory_uri( ) ."/style.css",
array()
);
//bootstrap css
wp_enqueue_style(
"bootstrap",
get_template_directory_uri( ) . "/bootstrap/css/bootstrap.min.css",
array(),
"3.4.1",
"all"
);
//Jquery
wp_enqueue_script(
"jquery",
get_template_directory_uri( ) . "/js/jquery-3.4.1.js",
array("jquery"),
"4.4.1",
true
);
//bootstrap js
wp_enqueue_script(
"bootstrap",
get_template_directory_uri( ) . "/bootstrap/js/bootstrap.min.js",
array(),
"3.4.1",
true
);
}
add_action("wp_enqueue_scripts", "enqueue_kraken_theme");
function kraken_theme_setup(){
add_theme_support( "menus" );
register_nav_menu( "primary", "Primary Header Navigation" );
}
add_action( "after_setup_theme", "kraken_theme_setup" );
【问题讨论】:
标签: javascript jquery wordpress twitter-bootstrap