• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wp_styles函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wp_styles函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_styles函数的具体用法?PHP wp_styles怎么用?PHP wp_styles使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wp_styles函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: zerowp_customizer_enqueue_font

 function zerowp_customizer_enqueue_font($option)
 {
     $font_name = get_theme_mod($option);
     if (empty($font_name)) {
         $font_name = 'Arial';
     }
     if (!in_array($font_name, zerowp_customizer_standard_fonts())) {
         $font_weight = get_theme_mod($option . '_weight', 400);
         $font_weight = !empty($font_weight) ? $font_weight : 400;
         $font_weight_in_url = !in_array(absint($font_weight), array(400, 700)) ? '400,700,' . $font_weight : '400,700';
         $font_name = trim($font_name);
         $handle = 'google_font_' . str_ireplace(' ', '_', $font_name);
         if (!wp_style_is($handle, 'enqueued')) {
             wp_register_style($handle, "//fonts.googleapis.com/css?family=" . str_ireplace(' ', '+', $font_name) . ":" . $font_weight_in_url);
             wp_enqueue_style($handle);
         } else {
             $registered_link = wp_styles()->query($handle)->src;
             if (strpos($registered_link, (string) $font_weight) === false) {
                 wp_deregister_style($handle);
                 wp_register_style($handle, $registered_link . ',' . $font_weight);
                 wp_enqueue_style($handle);
             }
         }
     }
 }
开发者ID:ZeroWP,项目名称:Customizer,代码行数:25,代码来源:functions.php


示例2: replace_admin_bar_style

 public function replace_admin_bar_style()
 {
     global $wp_styles;
     $wp_styles = wp_styles();
     if (!isset($wp_styles->registered['admin-bar'])) {
         return;
     }
     $this->replace_css('admin-bar', 'admin-bar.css', '');
 }
开发者ID:WpHub,项目名称:Dark-Admin,代码行数:9,代码来源:dark-admin.php


示例3: enqueueInclude

 public function enqueueInclude(FrontInclude $style)
 {
     if (defined('WP_DEBUG') && WP_DEBUG) {
         $dependencies = $style->getDependency();
         $scripts = wp_styles()->registered;
         foreach ($dependencies as $dependency) {
             if (!isset($scripts[$dependency])) {
                 trigger_error(sprintf('Dependency failed for %s, No style with handle %s is registered', $style->getHandle(), $dependency), E_USER_WARNING);
             }
         }
     }
     wp_enqueue_style($style->getHandle(), $style->getSrc(), $style->getDependency(), $style->getVersion(), $style->loadInFooter());
 }
开发者ID:ArtOfWP,项目名称:CloudLess,代码行数:13,代码来源:WpStyleIncludes.php


示例4: enqueue_scripts

 function enqueue_scripts()
 {
     $GLOBALS['is_IE'] = false;
     $wp_styles = wp_styles();
     $wp_scripts = wp_scripts();
     $this->plugin->enqueue_scripts();
     $this->assertContains('font-awesome', $wp_styles->queue);
     $this->assertContains('wpcw-admin', $wp_styles->queue);
     $this->assertContains('wpcw-admin', $wp_scripts->queue);
     $this->assertNotContains('wpcw-admin-ie', $wp_scripts->queue);
     $GLOBALS['is_IE'] = true;
     $this->plugin->enqueue_scripts();
     $this->assertContains('wpcw-admin-ie', $wp_scripts->queue);
 }
开发者ID:godaddy,项目名称:wp-contact-widgets,代码行数:14,代码来源:test-base-widget.php


示例5: test_widget

 function test_widget()
 {
     $instance = ['title' => 'test', 'labels' => ['value' => 'yes']];
     $args = ['before_widget' => '<div class="widget wpcw-widget-social"><div class="widget-content">', 'after_widget' => '</div><div class="clear"></div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>'];
     $this->expectOutputRegex('/<div class="widget wpcw-widget-social"><div class="widget-content">/');
     $this->expectOutputRegex('/<h3 class="widget-title">/');
     $this->plugin->widget($args, $instance);
     // Tests that script & styles are enqueued enqueued
     do_action('wp_enqueue_scripts');
     $wp_styles = wp_styles();
     // Make sure the JS file is enqueued
     $this->assertContains('font-awesome', $wp_styles->queue);
     $this->assertContains('wpcw', $wp_styles->queue);
 }
开发者ID:godaddy,项目名称:wp-contact-widgets,代码行数:14,代码来源:test-class-social.php


示例6: test_widget

 function test_widget()
 {
     $instance = ['title' => 'test', 'labels' => ['value' => 'yes'], 'map' => ['value' => 'yes'], 'address' => ['value' => '<br>123 Santa Monica<br>']];
     $args = ['before_widget' => '<div class="widget wpcw-widget-contact"><div class="widget-content">', 'after_widget' => '</div><div class="clear"></div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>'];
     $this->expectOutputRegex('/<div class="widget wpcw-widget-contact"><div class="widget-content">/');
     $this->expectOutputRegex('/<h3 class="widget-title">/');
     // Check that we sprint the right google url
     $this->expectOutputRegex('~//www\\.google\\.com/maps\\?q=123\\+Santa\\+Monica&output=embed~');
     $this->plugin->widget($args, $instance);
     // Tests that script & styles are enqueued enqueued
     do_action('wp_enqueue_scripts');
     $wp_styles = wp_styles();
     $this->assertContains('wpcw', $wp_styles->queue);
 }
开发者ID:godaddy,项目名称:wp-contact-widgets,代码行数:14,代码来源:test-class-contact.php


示例7: __construct

 /**
  * Init
  */
 protected function __construct()
 {
     // init properties
     $this->wp_styles = wp_styles();
     $this->handles_loaded_async = get_option('bcd-css-handles', array());
     $this->critical_css = get_option('bcd-critical-css', '');
     // add wp hooks
     add_action('wp_print_styles', array($this, 'loadCSS'));
     add_filter('style_loader_tag', array($this, 'style_loader_tag'), 10, 3);
     if (strlen($this->critical_css)) {
         add_action('wp_print_styles', array($this, 'print_critical_css'));
     }
     // conditionally print debug information in the foot
     if (true === filter_input(INPUT_GET, 'debugBCD', FILTER_VALIDATE_BOOLEAN)) {
         add_action('wp_footer', array($this, 'footer_debug'), 9999);
     }
 }
开发者ID:proteusthemes,项目名称:better-css-delivery,代码行数:20,代码来源:better-css-delivery.php


示例8: register_assets

 /**
  * Register assets
  *
  * @since   0.1.0
  * @wp_hook action icon_picker_loader_init
  *
  * @param  Icon_Picker_Loader  $loader Icon_Picker_Loader instance.
  *
  * @return void
  */
 public function register_assets(Icon_Picker_Loader $loader)
 {
     if (empty($this->stylesheet_uri)) {
         return;
     }
     $register = true;
     $deps = false;
     $styles = wp_styles();
     if ($styles->query($this->stylesheet_id, 'registered')) {
         $object = $styles->registered[$this->stylesheet_id];
         if (version_compare($object->ver, $this->version, '<')) {
             $deps = $object->deps;
             wp_deregister_style($this->stylesheet_id);
         } else {
             $register = false;
         }
     }
     if ($register) {
         wp_register_style($this->stylesheet_id, $this->stylesheet_uri, $deps, $this->version);
     }
     $loader->add_style($this->stylesheet_id);
 }
开发者ID:vburlak,项目名称:wp-icon-picker,代码行数:32,代码来源:font.php


示例9: enqueue_preview_scripts

 /**
  * Enqueue preview scripts.
  *
  * @since 4.5.0
  * @access public
  */
 public function enqueue_preview_scripts()
 {
     wp_enqueue_script('customize-partial-refresh-preview');
     $wp_scripts = wp_scripts();
     $wp_styles = wp_styles();
     /*
      * Core does not rebuild MediaElement.js audio and video players when DOM subtrees change.
      * The Jetpack Infinite Scroll handles this when a post-load event is triggered.
      * Ideally this should be incorporated into Core.
      *
      * Hard-coded reference to a Jetpack module's event is not relevant for #coremerge.
      */
     if (class_exists('Jetpack')) {
         $exports = array();
         $handle = 'customize-partial-jetpack-support';
         $src = $this->dir_url . 'js/plugin-support/jetpack.js';
         $deps = array('customize-partial-refresh-preview');
         $in_footer = true;
         wp_enqueue_script($handle, $src, $deps, $this->get_version(), $in_footer);
         if (Jetpack::is_module_active('infinite-scroll')) {
             $exports['infiniteScroll'] = array('themeSupport' => current_theme_supports('infinite-scroll'));
         }
         if (Jetpack::is_module('widgets')) {
             $exports['widgets'] = array('scripts' => array('google-maps' => array('src' => 'https://maps.googleapis.com/maps/api/js?sensor=false'), 'contact-info-map-js' => array('src' => plugins_url('modules/widgets/contact-info/contact-info-map.js', JETPACK__PLUGIN_FILE), 'deps' => array('jquery', 'google-maps'))), 'styles' => array('contact-info-map-css' => array('src' => plugins_url('modules/widgets/contact-info/contact-info-map.css', JETPACK__PLUGIN_FILE))));
         }
         wp_scripts()->add_data($handle, 'data', sprintf('var _customizeSelectiveRefreshJetpackExports = %s;', wp_json_encode($exports)));
     }
     add_action('wp_footer', array($this, 'export_preview_data'), 1000);
 }
开发者ID:rheinardkorf,项目名称:wp-customize-partial-refresh,代码行数:35,代码来源:class-wp-customize-selective-refresh.php


示例10: wp_style_is

/**
 * Check whether a CSS stylesheet has been added to the queue.
 *
 * @since 2.8.0
 *
 * @param string $handle Name of the stylesheet.
 * @param string $list   Optional. Status of the stylesheet to check. Default 'enqueued'.
 *                       Accepts 'enqueued', 'registered', 'queue', 'to_do', and 'done'.
 * @return bool Whether style is queued.
 */
function wp_style_is($handle, $list = 'enqueued')
{
    _wp_scripts_maybe_doing_it_wrong(__FUNCTION__);
    return (bool) wp_styles()->query($handle, $list);
}
开发者ID:bobdenotter,项目名称:wordpress-theme,代码行数:15,代码来源:functions.wp-styles.php


示例11: test_enqueue_frontend_scripts

 /**
  * Test enqueue frontend scripts.
  *
  * @see Customize_Snapshot_Manager::enqueue_frontend_scripts()
  */
 function test_enqueue_frontend_scripts()
 {
     $this->plugin->register_scripts(wp_scripts());
     $this->plugin->register_styles(wp_styles());
     $manager = new Customize_Snapshot_Manager($this->plugin);
     $manager->init();
     $this->assertFalse(wp_script_is('customize-snapshots-frontend', 'enqueued'));
     $manager->enqueue_frontend_scripts();
     $this->assertFalse(wp_script_is('customize-snapshots-frontend', 'enqueued'));
     $_REQUEST['customize_snapshot_uuid'] = self::UUID;
     $manager = new Customize_Snapshot_Manager($this->plugin);
     $manager->init();
     $this->assertFalse(wp_script_is('customize-snapshots-frontend', 'enqueued'));
     $manager->enqueue_frontend_scripts();
     $this->assertTrue(wp_script_is('customize-snapshots-frontend', 'enqueued'));
 }
开发者ID:xwp,项目名称:wp-customize-snapshots,代码行数:21,代码来源:test-class-customize-snapshot-manager.php


示例12: register_assets

 /**
  * Register assets
  *
  * @since   0.1.0
  * @wp_hook action icon_picker_loader_init
  *
  * @param  Icon_Picker_Loader  $loader Icon_Picker_Loader instance.
  *
  * @return void
  */
 public function register_assets(Icon_Picker_Loader $loader)
 {
     if (empty($this->stylesheet_uri)) {
         return;
     }
     $register = true;
     $deps = false;
     $styles = wp_styles();
     /**
      * When the stylesheet ID of an icon type is already registered,
      * we'll compare its version with ours. If our stylesheet has greater
      * version number, we'll deregister the other stylesheet.
      */
     if ($styles->query($this->stylesheet_id, 'registered')) {
         $object = $styles->registered[$this->stylesheet_id];
         if (version_compare($object->ver, $this->version, '<')) {
             $deps = $object->deps;
             wp_deregister_style($this->stylesheet_id);
         } else {
             $register = false;
         }
     }
     if ($register) {
         wp_register_style($this->stylesheet_id, $this->stylesheet_uri, $deps, $this->version);
     }
     $loader->add_style($this->stylesheet_id);
 }
开发者ID:kucrut,项目名称:wp-icon-picker,代码行数:37,代码来源:font.php


示例13: cacsp_asset_enqueue_handler

/**
 * Asset enqueue handler on single social paper pages.
 *
 * Removes all styles except the most pertinent ones.
 *
 * @todo maybe do the same for scripts?
 */
function cacsp_asset_enqueue_handler()
{
    if (!cacsp_is_page() || is_404()) {
        return;
    }
    $styles = wp_styles();
    // wipe out all styles and only enqueue the ones we need
    $styles->queue = array('social-paper-single', 'side-comments-style', 'side-comments-theme', 'incom-style', 'media-views', 'wp-core-ui-colors', 'buttons', 'wp-auth-check', 'fee-modal', 'fee-link-modal', 'tinymce-core', 'tinymce-view', 'fee', 'dashicons', 'admin-bar', 'fee-adminbar');
    // enqueue our styles
    wp_enqueue_style('social-paper-single', Social_Paper::$URL . '/assets/css/single.css');
    wp_enqueue_style('social-paper-single-print', Social_Paper::$URL . '/assets/css/print.css', array('social-paper-single'), '0.1', 'print');
    if (function_exists('bp_is_active') && bp_is_active('groups')) {
        $select2_css_url = set_url_scheme('http://cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/css/select2.min.css');
        wp_enqueue_style('social-paper-select2', $select2_css_url);
    }
    // Register scripts.
    $sp_js_deps = array('jquery');
    if (function_exists('bp_is_active') && bp_is_active('groups')) {
        $select2_js_url = set_url_scheme('http://cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/js/select2.js');
        wp_register_script('social-paper-select2', $select2_js_url, array('jquery'));
        $sp_js_deps[] = 'social-paper-select2';
    }
    wp_enqueue_script('social-paper-single', Social_Paper::$URL . '/assets/js/single.js', $sp_js_deps);
    wp_localize_script('social-paper-single', 'SocialPaperL18n', array('group_placeholder' => __('Enter a group name', 'social-paper'), 'reader_placeholder' => __('Enter a user name', 'social-paper')));
}
开发者ID:sheesh,项目名称:social-paper,代码行数:32,代码来源:hooks-template.php


示例14: get_include_style

 /**
  * Get Style List
  *
  * @since 4.0.0
  */
 private function get_include_style()
 {
     return $this->add_suffix('.css', wp_styles()->queue);
 }
开发者ID:jtwb768,项目名称:cherryframework4,代码行数:9,代码来源:class-cherry-api-js.php


示例15: test_customize_controls_enqueue_scripts

 /**
  * @see Customize_Concurrency::customize_controls_enqueue_scripts()
  */
 function test_customize_controls_enqueue_scripts()
 {
     $this->plugin->register_scripts(wp_scripts());
     $this->plugin->register_styles(wp_styles());
     $instance = new Customize_Concurrency($this->plugin);
     $instance->customize_controls_enqueue_scripts();
     $this->assertTrue(wp_script_is($this->plugin->slug, 'enqueued'));
     $this->assertTrue(wp_style_is($this->plugin->slug, 'enqueued'));
     $this->assertEquals(1, has_action('customize_controls_print_footer_scripts', array($instance, 'export_js_data')));
 }
开发者ID:xwp,项目名称:wp-customize-concurrency,代码行数:13,代码来源:test-class-customize-concurrency.php


示例16: get_fontawesome_url

 /**
  * Gets the src url for the registered fontawesome handler
  * @param bool $ngg_provided_only
  * @return null|string|void
  */
 static function get_fontawesome_url($ngg_provided_only = FALSE)
 {
     $retval = NULL;
     if (wp_style_is('fontawesome', 'registered') && !$ngg_provided_only) {
         $style = wp_styles()->registered['fontawesome'];
         $retval = $style->src;
     } else {
         if (strpos(strtolower($_SERVER['SERVER_SOFTWARE']), 'microsoft-iis') !== FALSE) {
             $retval = site_url('/?ngg_serve_fontawesome_css=1');
         } else {
             $router = C_Router::get_instance();
             $retval = $router->get_static_url('photocrati-nextgen_gallery_display#fontawesome/font-awesome.css');
         }
     }
     return $retval;
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:21,代码来源:module.nextgen_gallery_display.php


示例17: wp_admin_css

/**
 * Enqueues or directly prints a stylesheet link to the specified CSS file.
 *
 * "Intelligently" decides to enqueue or to print the CSS file. If the
 * 'wp_print_styles' action has *not* yet been called, the CSS file will be
 * enqueued. If the wp_print_styles action *has* been called, the CSS link will
 * be printed. Printing may be forced by passing true as the $force_echo
 * (second) parameter.
 *
 * For backward compatibility with WordPress 2.3 calling method: If the $file
 * (first) parameter does not correspond to a registered CSS file, we assume
 * $file is a file relative to wp-admin/ without its ".css" extension. A
 * stylesheet link to that generated URL is printed.
 *
 * @since 2.3.0
 *
 * @param string $file       Optional. Style handle name or file name (without ".css" extension) relative
 * 	                         to wp-admin/. Defaults to 'wp-admin'.
 * @param bool   $force_echo Optional. Force the stylesheet link to be printed rather than enqueued.
 */
function wp_admin_css($file = 'wp-admin', $force_echo = false)
{
    // For backward compatibility
    $handle = 0 === strpos($file, 'css/') ? substr($file, 4) : $file;
    if (wp_styles()->query($handle)) {
        if ($force_echo || did_action('wp_print_styles')) {
            // we already printed the style queue. Print this one immediately
            wp_print_styles($handle);
        } else {
            // Add to style queue
            wp_enqueue_style($handle);
        }
        return;
    }
    /**
     * Filter the stylesheet link to the specified CSS file.
     *
     * If the site is set to display right-to-left, the RTL stylesheet link
     * will be used instead.
     *
     * @since 2.3.0
     *
     * @param string $file Style handle name or filename (without ".css" extension)
     *                     relative to wp-admin/. Defaults to 'wp-admin'.
     */
    echo apply_filters('wp_admin_css', "<link rel='stylesheet' href='" . esc_url(wp_admin_css_uri($file)) . "' type='text/css' />\n", $file);
    if (function_exists('is_rtl') && is_rtl()) {
        /** This filter is documented in wp-includes/general-template.php */
        echo apply_filters('wp_admin_css', "<link rel='stylesheet' href='" . esc_url(wp_admin_css_uri("{$file}-rtl")) . "' type='text/css' />\n", "{$file}-rtl");
    }
}
开发者ID:jenoya,项目名称:final,代码行数:51,代码来源:general-template.php


示例18: enqueue_styles

 /**
  * Set up any style sheets we need
  */
 function enqueue_styles()
 {
     if (!is_tax('presentation')) {
         return;
     }
     // Find theme's stylesheet
     $styles = wp_styles();
     $theme_handle = '';
     $parent_theme_handle = '';
     foreach ($styles->registered as $queue => $arg) {
         // Main theme
         if (false !== strpos($arg->src, get_stylesheet_uri())) {
             $theme_handle = $arg->handle;
             if (!is_child_theme()) {
                 break;
             }
         }
         // Parent theme
         if (is_child_theme() && false !== strpos($arg->src, get_template_directory_uri() . '/style.css')) {
             $parent_theme_handle = $arg->handle;
             if (!empty($theme_handle)) {
                 break;
             }
         }
     }
     // Found the theme's stylesheet; let's remove it!
     if (!empty($theme_handle)) {
         wp_deregister_style($theme_handle);
     }
     if (!empty($parent_theme_handle)) {
         wp_deregister_style($parent_theme_handle);
     }
     $options = $this->get_presentation_settings();
     if ('default' == $options['theme']) {
         $options['theme'] = 'league';
     }
     wp_register_style('theme-base', get_stylesheet_uri(), array(), $this->version, 'all');
     wp_register_style('reveal-js-presentations', plugins_url('css/reveal-js-presentations.css', dirname(__FILE__)), array(), $this->version, 'all');
     wp_register_style('reveal-js', plugins_url('reveal-js/css/reveal.css', dirname(__FILE__)), array('reveal-js-presentations'), $this->version, 'all');
     wp_register_style('reveal-theme', plugins_url(sprintf('reveal-js/css/theme/%s.css', $options['theme']), dirname(__FILE__)), array('reveal-js'), $this->version, 'all');
     wp_register_style('reveal-syntax', plugins_url('reveal-js/lib/css/zenburn.css', dirname(__FILE__)), array(), $this->version, 'all');
     wp_enqueue_style('reveal-theme');
     wp_enqueue_style('reveal-syntax');
 }
开发者ID:hwdsbcommons,项目名称:reveal-js-presentations,代码行数:47,代码来源:class-reveal-presentations.php


示例19: _print_styles

/**
 * Print styles (internal use only)
 *
 * @ignore
 *
 * @global bool $compress_css
 */
function _print_styles()
{
    global $compress_css;
    $wp_styles = wp_styles();
    $zip = $compress_css ? 1 : 0;
    if ($zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP) {
        $zip = 'gzip';
    }
    if (!empty($wp_styles->concat)) {
        $dir = $wp_styles->text_direction;
        $ver = $wp_styles->default_version;
        $href = $wp_styles->base_url . "/wp-admin/load-styles.php?c={$zip}&dir={$dir}&load=" . trim($wp_styles->concat, ', ') . '&ver=' . $ver;
        $css = "";
        foreach (array_unique(explode(',', trim($wp_styles->concat, ', '))) as $load) {
            if (!array_key_exists($load, $wp_styles->registered)) {
                continue;
            }
            $style = $wp_styles->registered[$load];
            $css .= file_get_contents(ABSPATH . $style->src) . '\\n';
            //			echo "<link rel='stylesheet' href='" . $style->src . "' type='text/css' media='all' />\n";
        }
        $path = '/wp-content/cache/' . md5($css) . '.css';
        $file_path = ABSPATH . $path;
        if (!file_exists($file_path)) {
            $file = fopen($file_path, 'w');
            fwrite($file, CssMin::minify($css));
            fclose($file);
        }
        echo "<link rel='stylesheet' href='" . $path . "' type='text/css' media='all' />\n";
        //		echo "<link rel='stylesheet' href='" . esc_attr($href) . "' type='text/css' media='all' />\n";
        if (!empty($wp_styles->print_code)) {
            echo "<style type='text/css'>\n";
            echo $wp_styles->print_code;
            echo "\n</style>\n";
        }
    }
    if (!empty($wp_styles->print_html)) {
        echo $wp_styles->print_html;
    }
}
开发者ID:ZaneXie,项目名称:WordPress,代码行数:47,代码来源:script-loader.php


示例20: postscript_get_reg_handles

/**
 * Gets registered scripts and styles.
 *
 * Gets WordPress default scripts/styles, then those plugin/theme registered.
 * The 'shutdown' hook fires after wp_default_scripts()/_styles()
 * and after admin screen has rendered (so enqueued scripts don't affect admin display).
 *
 * @since   0.1.0
 */
function postscript_get_reg_handles()
{
    if (is_admin()) {
        return;
    }
    // Hack to get front-end scripts into memory, from here in the back-end
    // (in $wp_scripts, $wp_styles) by firing the front-end registration hook.
    do_action('wp_enqueue_scripts');
    // Arrays now have front-end registered scripts.
    $wp_scripts_reg = wp_scripts();
    $wp_styles_reg = wp_styles();
    // Default and plugin/theme scripts array.
    $scripts_reg = $wp_scripts_reg->registered;
    $postscript_scripts_reg = get_transient('postscript_scripts_reg');
    $styles_reg = $wp_styles_reg->registered;
    $postscript_styles_reg = get_transient('postscript_styles_reg');
    // Set transients with scripts arrays (!= checks for new registrations).
    if ($scripts_reg != $postscript_scripts_reg) {
        set_transient('postscript_scripts_reg', $scripts_reg, 60 * 60 * 4);
    }
    if ($styles_reg != $postscript_styles_reg) {
        set_transient('postscript_styles_reg', $styles_reg, 60 * 60 * 4);
    }
    /* For future feature to separate defaults from plugin/theme scripts.
        // Get arrays of only back-end and only front-end scripts
        // by comparing before and after actions arrays.
        $wp_scripts_front = array_diff( $wp_scripts_reg, $wp_scripts_pre);
        $wp_scripts_back = array_intersect( $wp_scripts_reg, $wp_scripts_pre);
    
        // THIS GOES ABOVE AT TOP OF FN, ABOVE do_action().
        // Arrays with WordPress default and back-end scripts.
        $wp_scripts_pre = wp_scripts();
        $wp_styles_pre  = wp_styles();
    
        // Default scripts array.
        $scripts_pre            = $wp_scripts_pre->registered;
        $postscript_scripts_pre = get_transient( 'postscript_scripts_pre' );
    
        $styles_pre             = $wp_styles_pre->registered;
        $postscript_styles_pre  = get_transient( 'postscript_styles_pre' );
    
        // Set transients with defaults scripts.
        if ( $scripts_pre != $postscript_scripts_pre ) {
            set_transient( 'postscript_scripts_pre', $scripts_pre, 60 * 60 * 4 );
        }
    
        if ( $styles_pre != $postscript_styles_pre ) {
            set_transient( 'postscript_styles_pre', $styles_pre, 60 * 60 * 4 );
        }
        */
}
开发者ID:hearvox,项目名称:postscript,代码行数:60,代码来源:functions.php



注:本文中的wp_styles函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wp_super_cache_disable函数代码示例发布时间:2022-05-23
下一篇:
PHP wp_style_is函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap