当前位置: 首页>>代码示例>>PHP>>正文


PHP wp_script_add_data函数代码示例

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


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

示例1: twbsg_ie_fix

function twbsg_ie_fix()
{
    wp_enqueue_script('html5shiv', 'https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js', array(), false, false);
    wp_enqueue_script('respond', 'https://oss.maxcdn.com/respond/1.4.2/respond.min.js', array(), false, false);
    wp_script_add_data('html5shiv', 'conditional', 'lt IE 9');
    wp_script_add_data('respond', 'conditional', 'lt IE 9');
}
开发者ID:Wordpress-Development,项目名称:genesis-bootstrap,代码行数:7,代码来源:head.php

示例2: base_scripts

/** Enqueue scripts and styles */
function base_scripts()
{
    if (!is_admin()) {
        // Enqueue the main Stylesheet
        wp_enqueue_style('main', get_stylesheet_directory_uri() . '/assets/css/application.css', array(), '', 'all');
        // modernizr (from CDN)
        wp_enqueue_script('modernizr', '//cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.2/modernizr.min.js', array(), '2.8.2', false);
        // Deregister the jquery version bundled with WordPress.
        // CDN hosted jQuery placed in the header,
        // as some plugins require that jQuery is loaded in the header.
        wp_deregister_script('jquery');
        wp_enqueue_script('jquery', '//ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js', array(), '2.1.0', false);
        // Load the html5 shiv.
        wp_enqueue_script('twentysixteen-html5', get_template_directory_uri() . '/assets/js/html5.js', array(), '3.7.3');
        wp_script_add_data('twentysixteen-html5', 'conditional', 'lt IE 9');
        // Enqueue the main js
        // wp_enqueue_script( 'main', get_template_directory_uri() . '/assets/js/main.js', array('jquery'), '', true );
        //wp_enqueue_script( 'skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true );
        if (is_singular() && comments_open() && get_option('thread_comments')) {
            wp_enqueue_script('comment-reply');
        }
        // Google Fonts
        // wp_register_style('googleFonts', 'http://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic');
        // wp_enqueue_style( 'googleFonts');
    }
}
开发者ID:timbomckay,项目名称:base-theme,代码行数:27,代码来源:enqueue-scripts.php

示例3: add_scripts

/**
 * @author Vanderson Sena
 * @since Quatro Rodas
 */
function add_scripts()
{
    // Add Genericons, used in the main stylesheet.
    wp_enqueue_style('genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.4.1');
    // Theme stylesheet.
    wp_enqueue_style('quatrorodas-style', get_stylesheet_uri());
    // Load the Internet Explorer specific stylesheet.
    wp_enqueue_style('quatrorodas-ie', get_template_directory_uri() . '/css/ie.css', array('quatrorodas-style'), '20150825');
    wp_style_add_data('quatrorodas-ie', 'conditional', 'lt IE 10');
    // Load the Internet Explorer 8 specific stylesheet.
    wp_enqueue_style('quatrorodas-ie8', get_template_directory_uri() . '/css/ie8.css', array('quatrorodas-style'), '20150825');
    wp_style_add_data('quatrorodas-ie8', 'conditional', 'lt IE 9');
    // Load the Internet Explorer 7 specific stylesheet.
    wp_enqueue_style('quatrorodas-ie7', get_template_directory_uri() . '/css/ie7.css', array('quatrorodas-style'), '20150825');
    wp_style_add_data('quatrorodas-ie7', 'conditional', 'lt IE 8');
    // Load the html5 shiv.
    wp_enqueue_script('quatrorodas-html5', get_template_directory_uri() . '/js/html5.js', array(), '3.7.3');
    wp_script_add_data('quatrorodas-html5', 'conditional', 'lt IE 9');
    wp_enqueue_script('quatrorodas-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20150825', true);
    if (is_singular() && comments_open() && get_option('thread_comments')) {
        wp_enqueue_script('comment-reply');
    }
    if (is_singular() && wp_attachment_is_image()) {
        wp_enqueue_script('quatrorodas-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array('jquery'), '20150825');
    }
    wp_enqueue_script('quatrorodas-script', get_template_directory_uri() . '/js/functions.js', array('jquery'), '20150825', true);
    wp_localize_script('quatrorodas-script', 'screenReaderText', array('expand' => __('expand child menu', 'quatrorodas'), 'collapse' => __('collapse child menu', 'quatrorodas')));
}
开发者ID:vandersonsena,项目名称:wp-4rodas,代码行数:32,代码来源:functions.php

示例4: ct_author_load_scripts_styles

function ct_author_load_scripts_styles()
{
    wp_register_style('ct-author-google-fonts', '//fonts.googleapis.com/css?family=Rokkitt:400|Lato:400');
    // main JS file
    wp_enqueue_script('ct-author-js', get_template_directory_uri() . '/js/build/production.min.js', array('jquery'), '', true);
    wp_localize_script('ct-author-js', 'objectL10n', array('openPrimaryMenu' => __('open primary menu', 'author'), 'closePrimaryMenu' => __('close primary menu', 'author'), 'openChildMenu' => __('open child menu', 'author'), 'closeChildMenu' => __('close child menu', 'author')));
    // Google Fonts
    wp_enqueue_style('ct-author-google-fonts');
    // Font Awesome
    wp_enqueue_style('font-awesome', get_template_directory_uri() . '/assets/font-awesome/css/font-awesome.min.css');
    // load primary stylesheet
    if (is_rtl()) {
        wp_enqueue_style('ct-author-style-rtl', get_template_directory_uri() . '/styles/rtl.min.css');
    } else {
        wp_enqueue_style('ct-author-style', get_stylesheet_uri());
    }
    // enqueue comment-reply script only on posts & pages with comments open ( included in WP core )
    if (is_singular() && comments_open() && get_option('thread_comments')) {
        wp_enqueue_script('comment-reply');
    }
    /* Load Polyfills */
    // HTML5 shiv
    wp_enqueue_script('ct-author-html5-shiv', get_template_directory_uri() . '/js/build/html5shiv.min.js');
    wp_script_add_data('ct-author-html5-shiv', 'conditional', 'IE 8');
    // respond.js - media query support
    wp_enqueue_script('ct-author-respond', get_template_directory_uri() . '/js/build/respond.min.js', '', '', true);
    wp_script_add_data('ct-author-respond', 'conditional', 'IE 8');
}
开发者ID:kimyj9501,项目名称:SingMyStory,代码行数:28,代码来源:scripts.php

示例5: allonsy_wp_enqueue_scripts

/**
 * Queuing up JS and CSS for the front-end. Notes:
 *
 * - Use get_stylesheet_directory_uri() to pull from the parent theme, child themes use get_stylesheet_directory_uri()
 * - Use conditionals to restrict extra JS and CSS to specific templates and pages
 *
 * @see https://codex.wordpress.org/Function_Reference/wp_enqueue_style
 * @see https://codex.wordpress.org/Function_Reference/wp_enqueue_script
 *
 */
function allonsy_wp_enqueue_scripts()
{
    /*
     * Main stylesheet file for all pages, should be final, pre-processed file
     */
    wp_enqueue_style('allonsy-main', get_stylesheet_directory_uri() . '/assets/css/main.css', FALSE, ALLONSY_THEME_VERSION);
    /*
     * Conditionally load HTML5 shim for browsers less than or equal to IE 8
     * Same $wp_scripts->add_data() technique can be used for conditional IE stylesheets
     */
    wp_enqueue_script('allonsy-lte-ie8', get_template_directory_uri() . '/assets/js/vendor/html5shiv.min.js', array(), '3.7.3', FALSE);
    wp_script_add_data('allonsy-lte-ie8', 'conditional', 'lte IE 8');
    /*
     * Main JavaScript file
     * If using Browserify or other pre-processor, this should point to the final, compiled file
     */
    wp_enqueue_script('allonsy-main', get_stylesheet_directory_uri() . '/assets/js/main.js', array('jquery'), ALLONSY_THEME_VERSION, TRUE);
    /**
     * Localize JS file.
     * Creates a global variable that can be used in the smsframe-main JS file.
     * Used for:
     *
     * - Variables only provided in PHP
     * - Translation for any text output in JS
     * - Settings from the Customizer
     *
     * @see https://codex.wordpress.org/Function_Reference/wp_localize_script
     */
    wp_localize_script('allonsy-main', 'allonsyLocalVars', array('ajaxUrl' => admin_url('admin-ajax.php'), 'homeUrl' => home_url(), 'wpDebug' => defined('WP_DEBUG') ? WP_DEBUG : FALSE, 'i18n' => array('unknownError' => __('Something went wrong, pleas refresh the page and try again.', 'allons-y'))));
    if (is_singular() && comments_open() && get_option('thread_comments')) {
        wp_enqueue_script('comment-reply');
    }
}
开发者ID:joshcanhelp,项目名称:wp-starter,代码行数:43,代码来源:wp-enqueue.php

示例6: ct_chosen_load_scripts_styles

function ct_chosen_load_scripts_styles()
{
    wp_register_style('ct-chosen-google-fonts', '//fonts.googleapis.com/css?family=Playfair+Display:400|Raleway:400,700,400italic');
    // main JS file
    wp_enqueue_script('ct-chosen-js', get_template_directory_uri() . '/js/build/production.min.js', array('jquery'), '', true);
    wp_localize_script('ct-chosen-js', 'objectL10n', array('openMenu' => __('open menu', 'chosen'), 'closeMenu' => __('close menu', 'chosen'), 'openChildMenu' => __('open dropdown menu', 'chosen'), 'closeChildMenu' => __('close dropdown menu', 'chosen')));
    // Google Fonts
    wp_enqueue_style('ct-chosen-google-fonts');
    // Font Awesome
    wp_enqueue_style('font-awesome', get_template_directory_uri() . '/assets/font-awesome/css/font-awesome.min.css');
    // Stylesheet
    if (is_rtl()) {
        wp_enqueue_style('ct-chosen-style-rtl', get_template_directory_uri() . '/styles/rtl.min.css');
    } else {
        wp_enqueue_style('ct-chosen-style', get_stylesheet_uri());
    }
    // enqueue comment-reply script only on posts & pages with comments open ( included in WP core )
    if (is_singular() && comments_open() && get_option('thread_comments')) {
        wp_enqueue_script('comment-reply');
    }
    /* Load Polyfills */
    // HTML5 shiv
    wp_enqueue_script('ct-chosen-html5-shiv', get_template_directory_uri() . '/js/build/html5shiv.min.js');
    // respond.js - media query support
    wp_enqueue_script('ct-chosen-respond', get_template_directory_uri() . '/js/build/respond.min.js', '', '', true);
    // prevent fatal error on < WP 4.2 (load files unconditionally instead)
    if (function_exists('wp_script_add_data')) {
        wp_script_add_data('ct-chosen-html5-shiv', 'conditional', 'IE 8');
        wp_script_add_data('ct-chosen-respond', 'conditional', 'IE 8');
    }
}
开发者ID:Edamame88,项目名称:caetla_work,代码行数:31,代码来源:scripts.php

示例7: satu_enqueue

/**
 * Loads the theme styles & scripts.
 *
 * @since 1.0.0
 * @link  http://codex.wordpress.org/Function_Reference/wp_enqueue_script
 * @link  http://codex.wordpress.org/Function_Reference/wp_enqueue_style
 */
function satu_enqueue()
{
    // Add custom fonts, used in the main stylesheet.
    wp_enqueue_style('satu-fonts', satu_fonts_url(), array(), null);
    // if is not a child theme and WP_DEBUG and/or SCRIPT_DEBUG turned on, load the unminified styles & script.
    if (!is_child_theme() && WP_DEBUG || SCRIPT_DEBUG) {
        // Load main stylesheet
        wp_enqueue_style('satu-style', get_stylesheet_uri(), array('dashicons'));
        // Load custom js plugins.
        wp_enqueue_script('satu-plugins', trailingslashit(get_template_directory_uri()) . 'assets/js/plugins.min.js', array('jquery'), null, true);
        // Load custom js methods.
        wp_enqueue_script('satu-main', trailingslashit(get_template_directory_uri()) . 'assets/js/main.js', array('jquery'), null, true);
        // Load js function for responsive navigation.
        wp_enqueue_script('satu-mobile-nav', trailingslashit(get_template_directory_uri()) . 'assets/js/navigation.js', array(), null, true);
    } else {
        // Load main stylesheet
        wp_enqueue_style('satu-style', trailingslashit(get_template_directory_uri()) . 'style.min.css', array('dashicons'));
        // Load custom js plugins.
        wp_enqueue_script('satu-scripts', trailingslashit(get_template_directory_uri()) . 'assets/js/satu.min.js', array('jquery'), null, true);
        // Load js function for responsive navigation.
        wp_enqueue_script('satu-mobile-nav', trailingslashit(get_template_directory_uri()) . 'assets/js/navigation.js', array(), null, true);
    }
    // If child theme is active, load the stylesheet.
    if (is_child_theme()) {
        wp_enqueue_style('satu-child-style', get_stylesheet_uri());
    }
    // Load comment-reply script.
    if (is_singular() && comments_open() && get_option('thread_comments')) {
        wp_enqueue_script('comment-reply');
    }
    // Loads HTML5 Shiv
    wp_enqueue_script('standard-html5', trailingslashit(get_template_directory_uri()) . 'assets/js/html5shiv.min.js', array('jquery'), null, false);
    wp_script_add_data('standard-html5', 'conditional', 'lte IE 9');
}
开发者ID:satrya,项目名称:satu,代码行数:41,代码来源:scripts.php

示例8: selenenw_scripts

/**
 * Enqueue scripts and styles.
 */
function selenenw_scripts()
{
    // Load our main stylesheet.
    wp_enqueue_style('selenenw-style', get_stylesheet_uri());
    // Load supporting stylesheet
    wp_enqueue_style('selenenw-fonts', get_template_directory_uri() . '/css/fonts.css', array(), '20150814');
    wp_enqueue_style('selene-lightslider', get_template_directory_uri() . '/css/lightSlider.min.css', array(), '20150814');
    wp_enqueue_style('selenenw-animate', get_template_directory_uri() . '/css/animate.css', array(), '20150814');
    wp_enqueue_style('selenenw-lightgallery', get_template_directory_uri() . '/css/lightGallery.min.css', array(), '20150814');
    // Load google fonts
    wp_enqueue_style('selenenw-google-font', 'http://fonts.googleapis.com/css?family=Roboto+Slab:300,400,700|Raleway:400,500,600,700&amp;subset=latin,greek,cyrillic,vietnamese');
    // Load the Internet Explorer specific scripts.
    wp_enqueue_script('selenenw-html5shiv', 'https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js', array('selenenw-style'));
    wp_script_add_data('selenenw-html5shiv', 'conditional', 'lt IE 9');
    wp_enqueue_script('selenenw-respond', 'https://oss.maxcdn.com/respond/1.4.2/respond.min.js', array('selenenw-style'));
    wp_script_add_data('selenenw-respond', 'conditional', 'lt IE 9');
    // Load footer scripts
    wp_enqueue_script('selenenw-jetmenu', get_template_directory_uri() . '/js/jetmenu.js', array('jquery', 'jquery-ui-core'), '20150814', true);
    wp_enqueue_script('selenenw-uniform', get_template_directory_uri() . '/js/jquery.uniform.min.js', array('jquery', 'jquery-ui-core'), '20150814', true);
    wp_enqueue_script('selenenw-lightslider', get_template_directory_uri() . '/js/jquery.lightSlider.min.js', array('jquery', 'jquery-ui-core'), '20150814', true);
    wp_enqueue_script('selenenw-wow', get_template_directory_uri() . '/js/wow.min.js', array('jquery', 'jquery-ui-core'), '20150814', true);
    wp_enqueue_script('selenenw-scripts', get_template_directory_uri() . '/js/scripts.js', array('jquery', 'jquery-ui-core', 'jquery-ui-datepicker'), '20150814', true);
    wp_enqueue_script('selenenw-lightgallery', get_template_directory_uri() . '/js/lightGallery.min.js', array('jquery', 'jquery-ui-core', 'jquery-ui-datepicker'), '20150814', true);
    wp_enqueue_script('selenene-custom-js', get_template_directory_uri() . '/js/custom.js', array('jquery'), '20150814', true);
    wp_localize_script('selenene-custom-js', 'selenenw_ajax', array('ajax_url' => admin_url('admin-ajax.php'), 'site_url' => site_url()));
}
开发者ID:shesser,项目名称:selenenw,代码行数:29,代码来源:functions.php

示例9: pigeon_enqueue_scripts

/**
 * JavaScript読み込み
 */
function pigeon_enqueue_scripts()
{
    wp_enqueue_script('jquery');
    wp_enqueue_script('html5shiv', get_template_directory_uri() . '/js/html5shiv.min.js');
    wp_script_add_data('html5shiv', 'conditional', 'lt IE 9');
    wp_enqueue_script('respond', get_template_directory_uri() . '/js/respond.min.js');
}
开发者ID:ko31,项目名称:pigeon,代码行数:10,代码来源:functions.php

示例10: supermag_scripts

/**
 * Enqueue scripts and styles.
 */
function supermag_scripts()
{
    /*bxslider css*/
    wp_enqueue_style('jquery-bxslider', get_template_directory_uri() . '/assets/library/bxslider/css/jquery.bxslider.min.css', array(), '4.2.5');
    /*google font*/
    wp_enqueue_style('supermag-googleapis', '//fonts.googleapis.com/css?family=Oswald:300,400,700|Roboto:300italic,400,500,700', array(), '1.0.1');
    /*Font-Awesome-master*/
    wp_enqueue_style('fontawesome', get_template_directory_uri() . '/assets/library/Font-Awesome/css/font-awesome.min.css', array(), '4.5.0');
    /*main style*/
    wp_enqueue_style('supermag-style', get_stylesheet_uri());
    /*jquery start*/
    /*html5*/
    wp_enqueue_script('html5', get_template_directory_uri() . '/assets/library/html5shiv/html5shiv.min.js', array('jquery'), '3.7.3', false);
    wp_script_add_data('html5', 'conditional', 'lt IE 9');
    /*respond*/
    wp_enqueue_script('respond', get_template_directory_uri() . '/assets/library/respond/respond.min.js', array('jquery'), '1.1.2', false);
    wp_script_add_data('respond', 'conditional', 'lt IE 9');
    /*bxslider*/
    wp_enqueue_script('jquery-bxslider', get_template_directory_uri() . '/assets/library/bxslider/js/jquery.bxslider.min.js', array('jquery'), '4.2.5', 1);
    /*theme custom js*/
    wp_enqueue_script('supermag-custom', get_template_directory_uri() . '/assets/js/supermag-custom.js', array('jquery'), '1.1.3', 1);
    if (is_singular() && comments_open() && get_option('thread_comments')) {
        wp_enqueue_script('comment-reply');
    }
}
开发者ID:idea-lab,项目名称:Spectrum,代码行数:28,代码来源:core.php

示例11: tkuim_scripts

function tkuim_scripts()
{
    wp_enqueue_style('tkuim-fontawesome', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', array(), '4.5.0');
    wp_enqueue_style('tkuim-style', get_stylesheet_uri(), array(), '1.0.0');
    wp_enqueue_script('tkuim-html5', get_template_directory_uri() . '/js/html5.js', array(), '3.7.3');
    wp_script_add_data('tkuim-html5', 'conditional', 'lt IE 9');
}
开发者ID:tommy351,项目名称:wp-tkuim,代码行数:7,代码来源:functions.php

示例12: axmagazine_scripts

 function axmagazine_scripts()
 {
     wp_enqueue_style('axmagazine-style', get_stylesheet_uri());
     wp_enqueue_script('axmagazine-html5', 'https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js', array(), '3.7.3');
     wp_script_add_data('axmagazine-html5', 'conditional', 'lt IE 9');
     wp_enqueue_script('axmagazine-jquery', 'http://code.jquery.com/jquery-1.12.0.min.js', array(), false, true);
     wp_enqueue_script('axmagazine-script', get_template_directory_uri() . '/script.js', array(), false, true);
 }
开发者ID:Axel-Charpentier,项目名称:axmagazine,代码行数:8,代码来源:functions.php

示例13: lightning_addJs

function lightning_addJs()
{
    wp_enqueue_script('html5shiv', 'https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js');
    wp_script_add_data('html5shiv', 'conditional', 'lt IE 9');
    wp_enqueue_script('respond', 'https://oss.maxcdn.com/respond/1.4.2/respond.min.js');
    wp_script_add_data('respond', 'conditional', 'lt IE 9');
    wp_enqueue_script('lightning-js', get_template_directory_uri() . '/js/all.min.js', array('jquery'), '20150918a');
}
开发者ID:Dr0na,项目名称:Lightning,代码行数:8,代码来源:functions.php

示例14: qldgovt_enqueue_scripts

 /**
  * Enqueue our scripts and CSS.
  */
 function qldgovt_enqueue_scripts()
 {
     $suffix = SCRIPT_DEBUG ? '' : '.min';
     wp_enqueue_style('main', get_stylesheet_uri());
     wp_enqueue_script('qg', get_template_directory_uri() . "/assets/js/qg{$suffix}.js", array('jquery'), '1.0', true);
     wp_enqueue_style('ie-stylesheet', get_template_directory_uri() . "/assets/css/qg-ie{$suffix}.css", array());
     wp_style_add_data('ie-stylesheet', 'conditional', 'lt IE 8');
     wp_enqueue_script('ie-layout', get_template_directory_uri() . "/assets/js/ie-layout{$suffix}.js", array('jquery'));
     wp_script_add_data('ie-layout', 'conditional', 'lt IE 9');
 }
开发者ID:humanmade,项目名称:Queensland-Government-Theme,代码行数:13,代码来源:functions.php

示例15: enqueueScripts

 /**
  * Enqueue scripts for stats page only (Flot charting library).
  *
  * @param  string $hook
  * @return void
  */
 public function enqueueScripts($hook)
 {
     if ($hook !== 'optimizepress_page_optimizepress-stats') {
         return;
     }
     wp_enqueue_script('excanvas', OP_JS . 'excanvas.min.js', false, '1.0.0', true);
     wp_script_add_data('excanvas', 'conditional', 'lte IE 8');
     wp_enqueue_script('flot', OP_JS . 'flot/jquery.flot.min.js', array('jquery'), '0.8.3', true);
     wp_enqueue_script('op-flot-init', OP_JS . 'flot/op-flot-init' . OP_SCRIPT_DEBUG . '.js', array('jquery', 'flot'), OP_VERSION, true);
     wp_localize_script('op-flot-init', 'OpStats', array('data' => op_optin_stats_get_chart_formated_data()));
 }
开发者ID:kyscastellanos,项目名称:arepa,代码行数:17,代码来源:stats.php


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