Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/236.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/74.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
Php Wordpress wp_排队加载css而不是js_Php_Jquery_Css_Wordpress - Fatal编程技术网

Php Wordpress wp_排队加载css而不是js

Php Wordpress wp_排队加载css而不是js,php,jquery,css,wordpress,Php,Jquery,Css,Wordpress,我的网站正在加载css文件,但不是js。 my header.php: <!doctype html> <html class="no-js" lang="de-DE"> <head> <meta charset="UTF-8"> <title>//</title> <?php wp_head(); ?> </head> // 和my functions.p

我的网站正在加载css文件,但不是js。 my header.php:

<!doctype html>
<html class="no-js" lang="de-DE">
<head>
    <meta charset="UTF-8">
    <title>//</title>   
    <?php wp_head(); ?>

</head>

//   
和my functions.php:

<?php

    function include_all() {
        wp_enqueue_style( 'app', get_template_directory_uri() . '/css/app.css',false,'1.1','all');
        //---
        wp_deregister_script('jquery');
        wp_enqueue_script('jquery', 'https://code.jquery.com/jquery-2.2.4.min.js', array(), null, true);
        //---
        wp_enqueue_script( 'app', get_template_directory_uri() . '/js/app.js', array('jquery'), null, true );


    }
    add_action('wp_enqueue_scripts', 'include_all');

?>

我想禁用wordpress的jquery来使用我自己的版本,但它只加载css。这是在wordpress中包含js和css的最佳方式吗


提前感谢,我感谢您提供的任何帮助。

请注册js文件,然后将其排队,试试这个例子

function include_all() {

 wp_register_script('app', get_template_directory_uri() . '/js/app.js', array('jquery'), null, true );
 wp_enqueue_script('app');
}
add_action ('wp_enqueue_scripts', 'include_all');

“jquery”名称已保留。用这个

wp_enqueue_script('custom-jquery', 'https://code.jquery.com/jquery-2.2.4.min.js', array(), null, true);

wp_enqueue_script( 'app', get_template_directory_uri() . '/js/app.js', array('custom-jquery'), null, true );

好了,现在可以工作了:D忘记在index.php中添加


wp_enqueue_脚本('app',get_template_directory_uri()。/js/app.js',数组('custom-jquery'),null,true

检查队列参数wp\u enqueue\u script($handle、$src、$deps、$ver、$in\u footer);并在wp_register_脚本中正确定义('app',get_template_directory_uri()。/js/app.js');wp_排队_脚本(“应用程序”);