AI助手支持GPT4.0
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) code>和 wp_enqueue_style( $handle, $src, $deps, $ver, $media ) as in:wp_enqueue_style($ handle,$ src,$ deps,$ ver,$ media) code>如下: p>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') code> pre>$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') code>,则将在加载jquery后加载脚本。 p>The problem is, which one exists and in which order are they loaded ?问题是,存在哪一种,以什么顺序加载? p>Debug Bar List Script & Style Dependencies, an add-on to Debug Bar, will list the dependencies.<调试栏列表脚本和样式依赖性,调试栏的附加组件,将列出依赖性。 /p>/ p>Use使用 h4>To view the loaded scripts and styles查看加载的脚本和样式 p>Front-end: Go to the front-end, and on the admin bar choose Debug and view Script & Style Dependencies前端:转到前端,然后在管理栏上选择“调试”并查看“脚本和样式依赖项” li>Back-end: Go to the back-end, on the admin bar choose Debug and view Script & Style Dependencies后端:转到后端,在管理栏上选择“调试”并查看“脚本和样式依赖项” li> ul>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.另外,前端和后端上的不同页面可以加载不同的脚本和样式。 p>
wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer )
我们都知道,当我们向WordPress添加脚本或样式时,应该使用 wp_enqueue_script($ handle,$ src,$ deps,$ ver,$ in_footer) code>和 wp_enqueue_style( $handle, $src, $deps, $ver, $media ) as in:wp_enqueue_style($ handle,$ src,$ deps,$ ver,$ media) code>如下: p>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') code> pre>$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') code>,则将在加载jquery后加载脚本。 p>The problem is, which one exists and in which order are they loaded ?问题是,存在哪一种,以什么顺序加载? p>Debug Bar List Script & Style Dependencies, an add-on to Debug Bar, will list the dependencies.<调试栏列表脚本和样式依赖性,调试栏的附加组件,将列出依赖性。 /p>/ p>Use使用 h4>To view the loaded scripts and styles查看加载的脚本和样式 p>Front-end: Go to the front-end, and on the admin bar choose Debug and view Script & Style Dependencies前端:转到前端,然后在管理栏上选择“调试”并查看“脚本和样式依赖项” li>Back-end: Go to the back-end, on the admin bar choose Debug and view Script & Style Dependencies后端:转到后端,在管理栏上选择“调试”并查看“脚本和样式依赖项” li> ul>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.另外,前端和后端上的不同页面可以加载不同的脚本和样式。 p>
我们都知道,当我们向WordPress添加脚本或样式时,应该使用 wp_enqueue_script($ handle,$ src,$ deps,$ ver,$ in_footer) code>和 wp_enqueue_style( $handle, $src, $deps, $ver, $media ) as in:
wp_enqueue_script($ handle,$ src,$ deps,$ ver,$ in_footer) code>和 wp_enqueue_style( $handle, $src, $deps, $ver, $media ) as in:
wp_enqueue_style( $handle, $src, $deps, $ver, $media )
wp_enqueue_style($ handle,$ src,$ deps,$ ver,$ media) code>如下: p>
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') code> pre>$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') code>,则将在加载jquery后加载脚本。 p>The problem is, which one exists and in which order are they loaded ?问题是,存在哪一种,以什么顺序加载? p>Debug Bar List Script & Style Dependencies, an add-on to Debug Bar, will list the dependencies.<调试栏列表脚本和样式依赖性,调试栏的附加组件,将列出依赖性。 /p>/ p>Use使用 h4>To view the loaded scripts and styles查看加载的脚本和样式 p>Front-end: Go to the front-end, and on the admin bar choose Debug and view Script & Style Dependencies前端:转到前端,然后在管理栏上选择“调试”并查看“脚本和样式依赖项” li>Back-end: Go to the back-end, on the admin bar choose Debug and view Script & Style Dependencies后端:转到后端,在管理栏上选择“调试”并查看“脚本和样式依赖项” li> ul>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.另外,前端和后端上的不同页面可以加载不同的脚本和样式。 p>
函数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')
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')
code> pre>
$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.
array('jquery')
如果$ deps是 array('jquery') code>,则将在加载jquery后加载脚本。 p>The problem is, which one exists and in which order are they loaded ?问题是,存在哪一种,以什么顺序加载? p>Debug Bar List Script & Style Dependencies, an add-on to Debug Bar, will list the dependencies.<调试栏列表脚本和样式依赖性,调试栏的附加组件,将列出依赖性。 /p>/ p>Use使用 h4>To view the loaded scripts and styles查看加载的脚本和样式 p>Front-end: Go to the front-end, and on the admin bar choose Debug and view Script & Style Dependencies前端:转到前端,然后在管理栏上选择“调试”并查看“脚本和样式依赖项” li>Back-end: Go to the back-end, on the admin bar choose Debug and view Script & Style Dependencies后端:转到后端,在管理栏上选择“调试”并查看“脚本和样式依赖项” li> ul>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.另外,前端和后端上的不同页面可以加载不同的脚本和样式。 p>
array('jquery') code>,则将在加载jquery后加载脚本。 p>The problem is, which one exists and in which order are they loaded ?问题是,存在哪一种,以什么顺序加载? p>Debug Bar List Script & Style Dependencies, an add-on to Debug Bar, will list the dependencies.<调试栏列表脚本和样式依赖性,调试栏的附加组件,将列出依赖性。 /p>/ p>Use使用 h4>To view the loaded scripts and styles查看加载的脚本和样式 p>Front-end: Go to the front-end, and on the admin bar choose Debug and view Script & Style Dependencies前端:转到前端,然后在管理栏上选择“调试”并查看“脚本和样式依赖项” li>Back-end: Go to the back-end, on the admin bar choose Debug and view Script & Style Dependencies后端:转到后端,在管理栏上选择“调试”并查看“脚本和样式依赖项” li> ul>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.另外,前端和后端上的不同页面可以加载不同的脚本和样式。 p>
The problem is, which one exists and in which order are they loaded ?
问题是,存在哪一种,以什么顺序加载? p>
Debug Bar List Script & Style Dependencies, an add-on to Debug Bar, will list the dependencies.<
调试栏列表脚本和样式依赖性,调试栏的附加组件,将列出依赖性。
/p>
/ p>
To view the loaded scripts and styles
查看加载的脚本和样式 p>
ul>
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.
另外,前端和后端上的不同页面可以加载不同的脚本和样式。 p>
ol>
原文出处:http://www.sanshu.cn/a/10393.html
群主管理都是支付大佬