我一直在我们所有的网站上推出一个cookie欧盟法律脚本。在我访问这个网站之前,一直都很好:
http://www.ukhealthgateway.com/
由于某种原因,它只是不会加载。我认为它与插件冲突。有人可以看看吗?
这就是Wordpress输出的内容:
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>National Health Service market access & entry - UK HealthGateway UK HealthGateway</title>
<link rel="stylesheet" href="http://www.ukhealthgateway.com/wp-content/themes/default/style.css" type="text/css" media="screen" />
<link rel="pingback" href="http://www.ukhealthgateway.com/xmlrpc.php" />
<link href='http://fonts.googleapis.com/css?family=Oswald:400,300,700' rel='stylesheet' type='text/css'>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="http://www.ukhealthgateway.com/wp-content/themes/default/cookie_law.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('body').cwAllowCookies();
});
</script>
<!-- This site is optimized with the Yoast WordPress SEO plugin v1.1.5 - http://yoast.com/wordpress/seo/ -->
<meta name="description" content="Selling to the UK National Health Service is challenging and time consuming. UK HealthGateway gives you the solutions and services to quickly and cost-effectively win sales."/>
<link rel="canonical" href="http://www.ukhealthgateway.com/" />
<meta name="google-site-verification" content="9topKAjyLtAge98viaRrfR2QaeQEAdHk4WI_aMDlD-Q" />
<!-- / Yoast WordPress SEO plugin. -->
<link rel="alternate" type="application/rss+xml" title="UK HealthGateway » Feed" href="http://www.ukhealthgateway.com/feed/" />
<link rel="alternate" type="application/rss+xml" title="UK HealthGateway » Comments Feed" href="http://www.ukhealthgateway.com/comments/feed/" />
<script type="text/javascript">//<![CDATA[
// Google Analytics for WordPress by Yoast v4.2.3 | http://yoast.com/wordpress/google-analytics/
var _gaq = _gaq || [];
_gaq.push(['_setAccount','']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
//]]></script>
<link rel="alternate" type="application/rss+xml" title="UK HealthGateway » Home Comments Feed" href="http://www.ukhealthgateway.com/home/feed/" />
<link rel='stylesheet' id='jigoshop_frontend_styles-css' href='http://www.ukhealthgateway.com/wp-content/plugins/jigoshop/assets/css/frontend.css?ver=3.3.1' type='text/css' media='all' />
<link rel='stylesheet' id='jqueryui_styles-css' href='http://www.ukhealthgateway.com/wp-content/plugins/jigoshop/assets/css/ui.css?ver=3.3.1' type='text/css' media='all' />
<link rel='stylesheet' id='jigoshop_fancybox_styles-css' href='http://www.ukhealthgateway.com/wp-content/plugins/jigoshop/assets/css/fancybox.css?ver=3.3.1' type='text/css' media='all' />
<link rel='stylesheet' id='nivoStyleSheet-css' href='http://www.ukhealthgateway.com/wp-content/plugins/nivo-slider-light/nivo-slider.css?ver=3.3.1' type='text/css' media='all' />
<link rel='stylesheet' id='nivoCustomStyleSheet-css' href='http://www.ukhealthgateway.com/wp-content/plugins/nivo-slider-light/custom-nivo-slider.css?ver=3.3.1' type='text/css' media='all' />
<link rel='stylesheet' id='tribe-events-calendar-style-css' href='http://www.ukhealthgateway.com/wp-content/plugins/the-events-calendar/resources/events.css?ver=3.3.1' type='text/css' media='all' />
<script type='text/javascript' src='http://www.ukhealthgateway.com/wp-includes/js/jquery/jquery.js?ver=1.7.1'></script>
<script type='text/javascript' src='http://www.ukhealthgateway.com/wp-content/plugins/nivo-slider-light/jquery.nivo.slider.pack.js?ver=3.3.1'></script>
<script type='text/javascript' src='http://www.ukhealthgateway.com/wp-content/plugins/jigoshop/assets/js/jquery.fancybox-1.3.4.pack.js?ver=1.0'></script>
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js?ver=1.0'></script>
<script type='text/javascript' src='http://www.ukhealthgateway.com/wp-content/plugins/jigoshop/assets/js/jigoshop_frontend.js?ver=1.0'></script>
<script type='text/javascript' src='http://www.ukhealthgateway.com/wp-content/plugins/jigoshop/assets/js/script.js?ver=1.0'></script>
<script type='text/javascript' src='http://www.ukhealthgateway.com/wp-content/plugins/the-events-calendar/resources/jquery.pjax.js?ver=3.3.1'></script>
<script type='text/javascript' src='http://www.ukhealthgateway.com/wp-content/plugins/the-events-calendar/resources/events.js?ver=3.3.1'></script>
<script type='text/javascript' src='http://www.ukhealthgateway.com/wp-includes/js/comment-reply.js?ver=20090102'></script>
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://www.ukhealthgateway.com/xmlrpc.php?rsd" />
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://www.ukhealthgateway.com/wp-includes/wlwmanifest.xml" />
<meta name="generator" content="WordPress 3.3.1" />
<script type="text/javascript">
/* <![CDATA[ */
jQuery(document).ready(function($){
$(".nivoSlider br").each(function(){ // strip BR elements created by Wordpress
$(this).remove();
});
$('.nivoSlider').nivoSlider({
effect:'fade', //Specify sets like: 'random,fold,fade,sliceDown'
// All effects:
// sliceDown, sliceDownLeft, sliceUp, sliceUpLeft, sliceUpDown
// sliceUpDownLeft, fold, fade, random, slideInRight,
// slideInLeft, boxRandom, boxRain, boxRainReverse, boxRainGrow
// boxRainGrowReverse
animSpeed:500, //Slide transition speed
pauseTime:6000,
startSlide:0, //Set starting Slide (0 index)
directionNav:true, //Next & Prev
directionNavHide:true, //Only show on hover
controlNav:false, //1,2,3...
controlNavThumbs:false, //Use thumbnails for Control Nav
controlNavThumbsFromRel:false, //Use image rel for thumbs
controlNavThumbsSearch: '.jpg', //Replace this with...
controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
keyboardNav:true, //Use left & right arrows
pauseOnHover:true, //Stop animation while hovering
manualAdvance:false, //Force manual transitions
captionOpacity:0.8, //Universal caption opacity
beforeChange: function(){},
afterChange: function(){},
slideshowEnd: function(){} //Triggers after all slides have been shown
});
});
/* ]]> */
</script>
</head>
更新: 我已经做了你的建议(删除了jQuery 1.4.2,移动了cookie脚本,因此它在Nivoslider之后加载并将$更改为jQuery)。它仍然无法加载。例如,我在teamworksdesign.com上使用完全相同的脚本,它工作正常。差异似乎是,该网站使用Wordpress 3.1.3,而我的问题中的网站使用3.3.1。它也适用于IE7,但不适用于现代浏览器。
答案 0 :(得分:1)
好的,看起来你已经将代码直接插入了脑袋。 Wordpress安装附带的jQuery库正在页面下方进一步排队(版本1.7.1),因此您也不需要添加jQuery 1.4.2。可能就是这样。
如果不是,可能值得将functions.php中的cookie脚本与其他脚本一起正确排队(jQuery UI和Nivoslider正在那里排队)。正如James Allardice所提到的,你可以添加你的
$('body').cwAllowCookies();
到在关闭头标记之前设置Nivoslider的onload脚本,它使用的是jQuery()而不是$()。
答案 1 :(得分:0)
有一些 apache安全模块,用于查找包含cookie.js的文件名,但它们不提供该文件。
我在Drupal上遇到了这个问题,我发现this thread记录了它。