Wordpress插件没有';不加载jQuery或CSS

Wordpress插件没有';不加载jQuery或CSS,wordpress,Wordpress,我以前使用过相同的代码,但它起作用了,所以问题不在于代码。我只更改了当前代码中的类名,但它没有加载jQuery或CSS。这就是我对脚本的调用方式 add_action( 'wp_enqueue_scripts', 'scripts' ); function scripts() { wp_enqueue_style( 'style', plugins_url('css/style.css', __FILE__) ); wp_enqueue_script( 'sty

我以前使用过相同的代码,但它起作用了,所以问题不在于代码。我只更改了当前代码中的类名,但它没有加载jQuery或CSS。这就是我对脚本的调用方式

add_action( 'wp_enqueue_scripts', 'scripts' );

function scripts() {
        wp_enqueue_style( 'style', plugins_url('css/style.css', __FILE__) );
        wp_enqueue_script( 'style' );
        wp_register_script( 'jquery', plugins_url('js/jquery.js',__FILE__ ), array( 'jquery' ));
        wp_enqueue_script('jquery');
}

就像我说的,我以前使用过完全相同的方法,但这次不起作用。不知道该怎么办。谢谢

最终更新:找出plugin dir在单词之间有空格,删除空格,插件工作:)

更新代码

V2


最后更新:找出plugin dir在单词之间有空格,删除空格后,plugin工作:)

更新代码

V2


前两行代码固定为注册和输入CSSThank以获得您的答案!我已经试过了,但是仍然没有加载jQuery和CSS。你的网站在线吗?我可以在我的浏览器上看到吗?我正在使用localhost。我以前也有过同样的问题。脚本没有加载,一天后它突然工作了。你可以试试V2代码,我只是更新了我的答案,我使用相同的,每次都可以正常工作。还要确保css和JS在同一个文件夹中:)代码的前两行已固定,以注册CSSThanks并获得答案!我已经试过了,但是仍然没有加载jQuery和CSS。你的网站在线吗?我可以在我的浏览器上看到吗?我正在使用localhost。我以前也有过同样的问题。脚本没有加载,一天后它突然工作了。你可以试试V2代码,我只是更新了我的答案,我使用相同的,每次都可以正常工作。还要确保css和JS在同一个文件夹中:)谢谢,我做了您建议的更改,但它仍然不会加载jQuery或css。您不需要通过include jQuery.JS文件添加jQuery。wordpress附带了最新的jquery文件。您只需添加
wp\u enqueue\u脚本('jquery')
谢谢,我做了您建议的更改,但它仍然没有加载jquery或CSS。您不需要通过include jquery.js文件添加jquery。wordpress附带了最新的jquery文件。您只需添加
wp\u enqueue\u脚本('jquery')
function scripts() {
wp_register_style( 'style', plugins_url('css/style.css', __FILE__) );
wp_enqueue_style( 'style' );
wp_register_script( 'jquery', plugins_url('js/jquery.js',__FILE__ ), array( 'jquery' ));
wp_enqueue_script('jquery');
}
function scripts() {
if ( ! defined( 'MyPLUGIN_URL' ) )
    define( 'MyPLUGIN_URL', plugin_dir_url( __FILE__ ) );

wp_register_style( 'style', MyPLUGIN_URL .'css/style.css');
wp_enqueue_style( 'style' );

wp_register_script( 'jquery', MyPLUGIN_URL .'js/jquery.js');
wp_enqueue_script('jquery');
}
function scripts_func()
{
    //----------------------------------------------
    //  Include css file
    //----------------------------------------------
    wp_register_style( 'style', plugin_dir_url(__FILE__).'css/style.css', '', '1.0', 'all' );
    wp_enqueue_style('style');


    //----------------------------------------------
    //  Include javascript file
    //----------------------------------------------
    wp_enqueue_script( 'my-js',  plugin_dir_url(__FILE__).'assets/myjs.js', array('jquery'), '1.0', false );

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