本文整理汇总了PHP中WP_Scripts::remove方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Scripts::remove方法的具体用法?PHP WP_Scripts::remove怎么用?PHP WP_Scripts::remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WP_Scripts
的用法示例。
在下文中一共展示了WP_Scripts::remove方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wp_deregister_script
function wp_deregister_script($handle)
{
global $wp_scripts;
if (!is_a($wp_scripts, 'WP_Scripts')) {
$wp_scripts = new WP_Scripts();
}
$wp_scripts->remove($handle);
}
示例2: wp_deregister_script
/**
* Remove a registered script.
*
* @since r16
* @see WP_Scripts::remove() For parameter information.
*/
function wp_deregister_script($handle)
{
global $wp_scripts;
if (!is_a($wp_scripts, 'WP_Scripts')) {
if (!did_action('init')) {
_doing_it_wrong(__FUNCTION__, sprintf(__('Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.'), '<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>init</code>'), '3.3');
}
$wp_scripts = new WP_Scripts();
}
$wp_scripts->remove($handle);
}
示例3: wp_deregister_script
/**
* Remove a registered script.
*
* @since r16
* @see WP_Scripts::remove() For parameter information.
*/
function wp_deregister_script($handle)
{
global $wp_scripts;
if (!is_a($wp_scripts, 'WP_Scripts')) {
if (!did_action('init')) {
_doing_it_wrong(__FUNCTION__, sprintf(__('Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.'), '<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>login_enqueue_scripts</code>'), '3.3');
}
$wp_scripts = new WP_Scripts();
}
// Do not allow accidental or negligent deregistering of critical scripts in the admin. Show minimal remorse if the correct hook is used.
if (is_admin() && 'admin_enqueue_scripts' !== current_filter()) {
$no = array('jquery', 'jquery-core', 'jquery-migrate', 'jquery-ui-core', 'jquery-ui-accordion', 'jquery-ui-autocomplete', 'jquery-ui-button', 'jquery-ui-datepicker', 'jquery-ui-dialog', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-menu', 'jquery-ui-mouse', 'jquery-ui-position', 'jquery-ui-progressbar', 'jquery-ui-resizable', 'jquery-ui-selectable', 'jquery-ui-slider', 'jquery-ui-sortable', 'jquery-ui-spinner', 'jquery-ui-tabs', 'jquery-ui-tooltip', 'jquery-ui-widget', 'underscore', 'backbone');
if (in_array($handle, $no)) {
$message = sprintf(__('Do not deregister the %1$s script in the administration area. To target the frontend theme, use the %2$s hook.'), "<code>{$handle}</code>", '<code>wp_enqueue_scripts</code>');
_doing_it_wrong(__FUNCTION__, $message, '3.6');
return;
}
}
$wp_scripts->remove($handle);
}
示例4: filter_wp_default_scripts
/**
* Filter wp_default_scripts
*
* Removes an extra jQuery Script
*
* @since 5.0.0
*
* @param \WP_Scripts $scripts The Default WordPress scripts.
*
* @return void
*/
function filter_wp_default_scripts($scripts)
{
if (!is_admin()) {
$scripts->remove('jquery');
$scripts->add('jquery', false, array('jquery-core'), '1.12.3');
}
}
示例5: array
/**
* Register scripts.
*
* This will be moved to script-loader.php in #coremerge.
*
* @param WP_Scripts $wp_scripts Scripts.
*/
function register_scripts($wp_scripts)
{
$handle = 'customize-partial-refresh-pane';
$src = $this->dir_url . 'js/customize-partial-refresh-pane.js';
$deps = array('customize-controls', 'jquery', 'wp-util');
$in_footer = true;
$wp_scripts->add($handle, $src, $deps, $this->get_version(), $in_footer);
$handle = 'customize-widgets-hacks';
$src = $this->dir_url . 'js/customize-widgets-hacks.js';
$deps = array('customize-widgets');
$in_footer = true;
$wp_scripts->add($handle, $src, $deps, $this->get_version(), $in_footer);
$handle = 'customize-partial-refresh-preview';
$src = $this->dir_url . 'js/customize-partial-refresh-preview.js';
$deps = array('customize-preview', 'wp-util');
$in_footer = true;
$wp_scripts->add($handle, $src, $deps, $this->get_version(), $in_footer);
$handle = 'customize-preview-nav-menus';
$src = $this->dir_url . 'js/customize-preview-nav-menus.js';
$deps = array('customize-preview', 'customize-partial-refresh-preview');
$in_footer = true;
$wp_scripts->remove($handle);
$wp_scripts->add($handle, $src, $deps, $this->get_version(), $in_footer);
$handle = 'customize-preview-widgets';
$src = $this->dir_url . 'js/customize-preview-widgets.js';
$deps = array('customize-preview', 'customize-partial-refresh-preview');
$in_footer = true;
$wp_scripts->remove($handle);
$wp_scripts->add($handle, $src, $deps, $this->get_version(), $in_footer);
}
开发者ID:rheinardkorf,项目名称:wp-customize-partial-refresh,代码行数:37,代码来源:class-wp-customize-selective-refresh.php
示例6: dequeue_jquery_migrate
/**
* Dequeue jQuery migrate.
*
* @since 1.0.0
*
* @access private
* @param WP_Scripts $scripts Default scripts.
*/
public function dequeue_jquery_migrate($scripts)
{
if (!is_admin()) {
$scripts->remove('jquery');
$scripts->add('jquery', false, array('jquery-core'), false);
}
}