首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Cookie EU脚本与其他Wordpress插件冲突

Cookie EU脚本与其他Wordpress插件冲突
EN

Stack Overflow用户
提问于 2012-06-25 22:34:33
回答 2查看 489关注 0票数 0

我已经在我们所有的网站上推出了一个曲奇的欧盟法律脚本。在我访问这个网站之前,一切都很正常:

http://www.ukhealthgateway.com/

由于某些原因,它就是不能加载。我想它和一个插件冲突了。有人能看一下吗?

这是Wordpress在头部输出的内容:

代码语言:javascript
复制
<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上工作,但不能在现代浏览器上工作。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-06-26 03:50:49

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

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

代码语言:javascript
复制
$('body').cwAllowCookies(); 

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

票数 1
EN

Stack Overflow用户

发布于 2012-06-28 22:14:30

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

我在Drupal上遇到过这个问题,我找到了记录这个问题的this thread

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11191362

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档