简体   繁体   English

Bootstrap菜单在Wordpress中不起作用

[英]Bootstrap menu not working in wordpress

I'm having a problem with a collapsible bootstrap menu. 折叠式引导菜单出现问题。 I'm in the process of redesigning the home page of a Wordpress website. 我正在重新设计Wordpress网站的主页。 So i made a custom header, footer and template file for that. 因此,我为此创建了一个自定义的页眉,页脚和模板文件。 I'm also using bootstrap for the design. 我还在设计中使用引导程序。

I enqueue the required bootstrap CSS and JS files; 我排队所需的引导CSS和JS文件; everything else seems to be fine but the collapsible bootstrap menu is not working. 其他一切似乎都很好,但是可折叠的引导菜单不起作用。 I think that the bootstrap js is conflicting with the existing JS of the current theme. 我认为bootstrap js与当前主题的现有JS冲突。 I also tried loading the script in the custom header also, but that did not do the needful. 我也尝试将脚本加载到自定义标头中,但这没有必要。

What should be my next step? 我下一步应该怎么做?

Here's a test page . 这是一个测试页

If you view your console, the browser is returning the error: 如果您查看控制台,则浏览器将返回错误:

Uncaught Error: Bootstrap's JavaScript requires jQuery version 1.9.1 or higher 未捕获的错误:Bootstrap的JavaScript需要jQuery 1.9.1或更高版本

This theme is using v1.7.2 这个主题正在使用v1.7.2

Source: http://test.thedigitalmarketingonline.com/wp-content/themes/theme1887/js/jquery-1.7.2.min.js?ver=1.7.2 资料来源: http : //test.thedigitalmarketingonline.com/wp-content/themes/theme1887/js/jquery-1.7.2.min.js?ver=1.7.2

Your theme is using jQuery v1.7.2 it needs to be at least 1.9.1+ for Bootstrap. 您的主题使用的是jQuery v1.7.2,Bootstrap至少应为1.9.1+。 Check your theme files for where it's adding jQuery into the header (hopefully using wp_enqueue_script()) and comment out that line. 检查主题文件,以了解将jQuery添加到标题的位置(希望使用wp_enqueue_script()),并注释掉该行。 Then add this instead: 然后添加以下内容:

wp_enqueue_script( 'jquery');

If you're using the latest WordPress 3.6 or greater then the bundled version will be high enough for Bootstrap. 如果您使用的是最新的WordPress 3.6或更高版本,则捆绑版本对于Bootstrap来说足够高。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM