0

我一直在我们所有的网站上推出 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 &amp; 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 &raquo; Feed" href="http://www.ukhealthgateway.com/feed/" />
<link rel="alternate" type="application/rss+xml" title="UK HealthGateway &raquo; 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 &raquo; 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,但不适用于现代浏览器。

4

2 回答 2

1

好的,看起来您已将代码直接插入头部。您的 Wordpress 安装附带的 jQuery 库将在页面下方(版本 1.7.1)排入队列,因此您也不需要添加 jQuery 1.4.2。可能就是这样。

如果不是,则可能值得将您的 cookie 脚本与您的其他脚本(jQuery UI 和 Nivoslider 正在那里排队)一起正确地排在 functions.php 中。正如 James Allardice 提到的那样,您可以添加您的

$('body').cwAllowCookies(); 

对于在结束 head 标签之前设置 Nivoslider 的 onload 脚本,它使用 jQuery() 而不是 $()。

于 2012-06-25T19:50:48.813 回答
0

一些apache 安全模块会查找包含 cookie.js 的文件名,但它们不提供该文件。

我在 Drupal 上遇到过这个问题,我发现这个线程记录了它。

于 2012-06-28T14:14:29.697 回答