Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/227.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 不同wordpress页面上的Jquery冲突_Javascript_Php_Jquery_Wordpress_Parallax.js - Fatal编程技术网

Javascript 不同wordpress页面上的Jquery冲突

Javascript 不同wordpress页面上的Jquery冲突,javascript,php,jquery,wordpress,parallax.js,Javascript,Php,Jquery,Wordpress,Parallax.js,我在wordpress中使用以下代码: <?php function my_scripts_method() { if (is_page_template('front-page.php')) { // register your script location and dependencies wp_register_script('custom_script', get_template_directory_uri() . '/includes/jq

我在wordpress中使用以下代码:

<?php
function my_scripts_method() {

   if (is_page_template('front-page.php')) {
   // register your script location and dependencies

   wp_register_script('custom_script',
       get_template_directory_uri() . '/includes/jquery-1.10.2.min.js', array('jquery')
    ); 
    // enqueue the script
   wp_enqueue_script("custom_script"); 


  // add_action('wp_enqueue_scripts', 'my_scripts_method');

   // register your script location and dependencies
   wp_register_script('custom_script1',
       get_template_directory_uri() . '/includes/masonry.pkgd.min.js',
       array('jquery')
    );
   // enqueue the script
   wp_enqueue_script('custom_script1');

  // add_action('wp_enqueue_scripts', 'my_scripts_method');


     // register your script location and dependencies
   wp_register_script('custom_script2',
       get_template_directory_uri() . '/includes/unslider.min.js',
       array('jquery')
    );
   // enqueue the script
   wp_enqueue_script('custom_script2'); 

     // register your script location and dependencies
   wp_register_script('custom_script3',
       get_template_directory_uri() . '/includes/front-page.js',
       array('jquery')
    );
   // enqueue the script
   wp_enqueue_script('custom_script3'); 

   }
   if (is_page_template('our-story.php')) {
       wp_register_script('custom_script4',
       get_template_directory_uri() . '/includes/parallax.js',
       array('jquery')
    );
   // enqueue the script
   wp_enqueue_script('custom_script4'); 



   }

       wp_register_script('custom_script5',
       get_template_directory_uri() . '/includes/jquery.fancybox.js',
       array('jquery')
    );
   // enqueue the script
   wp_enqueue_script('custom_script5'); 



}

   add_action('wp_enqueue_scripts', 'my_scripts_method');


?>
我面临的问题是第一个/jquery-1.10.2.min.js库。当我包含这一点时,它只在front-page.php主页上运行良好,而其他jquery函数在任何其他页面上都无法正常工作。现在,当我删除这个库时,主页会被破坏。有什么建议我该如何解决这个问题?我尝试使用noconflict函数,但仍然得到相同的结果。另外,我在js文件中没有使用$usingjQuery


此外,如果条件是页面模板“front-page.php”在主页上不起作用。

使用控制台,告诉我们您收到了哪些错误。破碎是什么意思?在我们提供帮助之前,我们需要更多的输入。我在控制台中没有看到任何错误。我只看到了我提供的fb代码的工作原理。Breaked意味着如果我包括jquery库,只有我在主页上运行的js文件有效,其他任何页面的js文件无效。你包括jquery twiceWordpress包含它自己的版本吗?尝试添加wp_注销_脚本'jquery';在将jQuery排队并将句柄“custom_script”更改为“jQuery”之前。能否提供指向相关页面的链接?我尝试使用的唯一区别是,现在所有页面都无法工作。很抱歉,该网站仍在开发中。。