[wordpress插件] Debug Bar List Script & Style Dependencies调试栏列表脚本和样式依赖性

wordpress 插件 文章 2020-04-14 02:20 420 0 全屏看文

AI助手支持GPT4.0

评分
100
描述

We all know that when we're add a script or style to WordPress, we should use wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer ) and

我们都知道,当我们向WordPress添加脚本或样式时,应该使用 wp_enqueue_script($ handle,$ src,$ deps,$ ver,$ in_footer)

wp_enqueue_style( $handle, $src, $deps, $ver, $media ) as in:

wp_enqueue_style($ handle,$ src,$ deps,$ ver,$ media)如下:

function themeslug_enqueue_style() {    

 函数themeslug_enqueue_style(){    

wp_enqueue_style( 'core', 'style.css', array('twentytwelve-style') );

wp_enqueue_style('core','style.css',array('twentytwelve-style'));

}

}

function themeslug_enqueue_script() {    

函数themeslug_enqueue_script(){    

wp_enqueue_script( 'my-js', 'filename.js', array('jquery') );

wp_enqueue_script('my-js','filename.js',array('jquery'));

}

}

add_action( 'wp_enqueue_scripts', 'themeslug_enqueue_style' );

add_action('wp_enqueue_scripts','themeslug_enqueue_style');

add_action( 'wp_enqueue_scripts', 'themeslug_enqueue_script' )

add_action('wp_enqueue_scripts','themeslug_enqueue_script')

$deps (dependencies), the handle name and an optional parameter, lets you control when/where your script or style should be added.

$ deps(依赖项),句柄名称和可选参数,使您可以控制何时/何处应添加脚本或样式。

If $deps is array('jquery'), your script will be loaded after jquery is loaded.

如果$ deps是 array('jquery'),则将在加载jquery后加载脚本。

The problem is, which one exists and in which order are they loaded ?

问题是,存在哪一种,以什么顺序加载?

Debug Bar List Script & Style Dependencies, an add-on to Debug Bar, will list the dependencies.<

调试栏列表脚本和样式依赖性,调试栏的附加组件,将列出依赖性。

/p>

/ p>

Use

使用

To view the loaded scripts and styles

查看加载的脚本和样式

    • Front-end: Go to the front-end, and on the admin bar choose Debug and view Script & Style Dependencies
    • 前端:转到前端,然后在管理栏上选择“调试”并查看“脚本和样式依赖项”

    • Back-end: Go to the back-end, on the admin bar choose Debug and view Script & Style Dependencies
    • 后端:转到后端,在管理栏上选择“调试”并查看“脚本和样式依赖项”

    Note, the front-end and back-end loads different scripts and styles.

    请注意,前端和后端加载不同的脚本和样式。

    Also, different pages on the front-end and back-end can load different scripts and styles.

    另外,前端和后端上的不同页面可以加载不同的脚本和样式。

安装步骤

    1. Copy the ‘debug-bar-list-dependencies’ folder into your plugins folder
    2. 将“ debug-bar-list-dependencies”文件夹复制到您的插件文件夹中

    3. Activate the plugin via the Plugins admin page
    4. 通过“插件管理”页面激活插件

下载地址
https://downloads.wordpress.org/plugin/debug-bar-list-dependencies.1.1.2.zip
-EOF-

AI助手支持GPT4.0