2

I'm using a HTML 5 Reset Wordpress Theme as a framework for a project. The problem I'm having is with a plugin - slidedeck - that doesn't work, more precisely, the javascript doesn't load.

This is the link to the website: http://melisayavas.com/web (on the homepage the text should slide).

This is what I have in my functions.php:

// Load jQuery
  if ( !function_exists(core_mods) ) {
     function core_mods() {
        if ( !is_admin() ) {
          wp_deregister_script('jquery');
          wp_register_script('jquery', ("//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"), false);
          wp_enqueue_script('jquery');
           }
         }
           core_mods();
       }

In header.php the only script I have is this:

<script src="<?php bloginfo('template_directory'); ?>/_/js/modernizr-1.7.min.js">

And then in footer.php I have this:

<script src="<?php bloginfo('template_directory'); ?>/_/js/functions.js"></script>

Unfortunately, I don't know how to work with javascript / jQuery, I have no idea what I'm doing wrong or how should I fix it.

4

2 回答 2

2

在您使用的代码中

wp_deregister_script('jquery');
wp_register_script('jquery', ("//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"), false);
wp_enqueue_script('jquery');

结果你得到了这个错误

Failed to load resource: the server responded with a status of 404 (Not Found)

因为

http://melisayavas.com/web//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js? 是一个无效的 url,所以 jQuery 是未定义的

您可以通过将 url 更改为 (notice http:)来解决它

wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"), false);

注意:用于http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js始终获取最新版本。

于 2012-04-08T00:11:27.923 回答
1

同样重要的是要注意 WordPress 3.6 破坏了一些 SlideDeck 功能,因此请务必将 SlideDeck 升级到 2.3.3

有关更多信息,请参阅http://www.slidedeck.com/blog/news-updates/wordpress-3-6-making-your-slidedecks-cry-no-problem/

于 2013-08-05T18:21:48.450 回答