本文整理汇总了PHP中wp_register_script函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_register_script函数的具体用法?PHP wp_register_script怎么用?PHP wp_register_script使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_register_script函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: montkailash_scripts
/**
* Enqueue scripts and styles.
*
* @since Twenty Fifteen 1.0
*/
function montkailash_scripts()
{
// Load our main stylesheet.
wp_enqueue_style('bootstrap-style', get_template_directory_uri() . '/css/bootstrap.min.css');
wp_enqueue_style('bootstrap-style', get_template_directory_uri() . '/css/bootstrap-theme.min.css');
wp_enqueue_style('lightbox-style', get_template_directory_uri() . '/css/lightbox.css');
wp_enqueue_style('montkailash-style', get_stylesheet_uri());
if (is_page('Contact')) {
wp_register_script('gmap', "http://maps.google.com/maps/api/js?sensor=true", '', '', true);
wp_enqueue_script('gmap');
wp_enqueue_script('gmaps', get_template_directory_uri() . '/js/gmaps.js', array('jquery'), '', true);
wp_enqueue_script('function-map', get_template_directory_uri() . '/js/function_map.js', array('jquery'), '0.1', true);
}
if (!is_admin()) {
wp_deregister_script('jquery');
wp_register_script('jquery', "http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js", '', '1.8.3', true);
wp_enqueue_script('jquery');
wp_deregister_script('wonderplugin-slider-skins-script');
wp_deregister_script('wonderplugin-slider-script');
wp_deregister_script('wonderplugin-slider-creator-script');
wp_deregister_script('woo-vou-public-script');
wp_register_script('wonderplugin-slider-skins-script', plugins_url() . '/wonderplugin-slider/engine/wonderpluginsliderskins.js', array('jquery'), '4.9', true);
wp_register_script('wonderplugin-slider-script', plugins_url() . '/wonderplugin-slider/engine/wonderpluginslider.js', array('jquery'), '4.9', true);
wp_register_script('wonderplugin-slider-creator-script', plugins_url() . '/wonderplugin-slider/app/wonderplugin-slider-creator.js', array('jquery'), '4.9', true);
wp_register_script('woo-vou-public-script', plugins_url() . '/woocommerce-pdf-vouchers/includes/js/woo-vou-public.js', array('jquery'), '2.4.4', true);
wp_enqueue_script('bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '20150330', true);
wp_enqueue_script('lightbox', get_template_directory_uri() . '/js/lightbox.js', array('jquery'), '2.8.1', true);
wp_enqueue_script('montkailash-script', get_template_directory_uri() . '/js/functions.js', array('jquery'), '0.1', true);
}
}
开发者ID:flasomm,项目名称:Montkailash,代码行数:35,代码来源:functions.php
示例2: setup_wizard
/**
* Show the setup wizard
*/
public function setup_wizard()
{
if (empty($_GET['page']) || 'wc-setup' !== $_GET['page']) {
return;
}
$this->steps = array('introduction' => array('name' => __('Introduction', 'woocommerce'), 'view' => array($this, 'wc_setup_introduction'), 'handler' => ''), 'pages' => array('name' => __('Page Setup', 'woocommerce'), 'view' => array($this, 'wc_setup_pages'), 'handler' => array($this, 'wc_setup_pages_save')), 'locale' => array('name' => __('Store Locale', 'woocommerce'), 'view' => array($this, 'wc_setup_locale'), 'handler' => array($this, 'wc_setup_locale_save')), 'shipping_taxes' => array('name' => __('Shipping & Tax', 'woocommerce'), 'view' => array($this, 'wc_setup_shipping_taxes'), 'handler' => array($this, 'wc_setup_shipping_taxes_save')), 'payments' => array('name' => __('Payments', 'woocommerce'), 'view' => array($this, 'wc_setup_payments'), 'handler' => array($this, 'wc_setup_payments_save')), 'next_steps' => array('name' => __('Ready!', 'woocommerce'), 'view' => array($this, 'wc_setup_ready'), 'handler' => ''));
$this->step = isset($_GET['step']) ? sanitize_key($_GET['step']) : current(array_keys($this->steps));
$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
wp_register_script('select2', WC()->plugin_url() . '/assets/js/select2/select2' . $suffix . '.js', array('jquery'), '3.5.2');
wp_register_script('wc-enhanced-select', WC()->plugin_url() . '/assets/js/admin/wc-enhanced-select' . $suffix . '.js', array('jquery', 'select2'), WC_VERSION);
wp_localize_script('wc-enhanced-select', 'wc_enhanced_select_params', array('i18n_matches_1' => _x('One result is available, press enter to select it.', 'enhanced select', 'woocommerce'), 'i18n_matches_n' => _x('%qty% results are available, use up and down arrow keys to navigate.', 'enhanced select', 'woocommerce'), 'i18n_no_matches' => _x('No matches found', 'enhanced select', 'woocommerce'), 'i18n_ajax_error' => _x('Loading failed', 'enhanced select', 'woocommerce'), 'i18n_input_too_short_1' => _x('Please enter 1 or more characters', 'enhanced select', 'woocommerce'), 'i18n_input_too_short_n' => _x('Please enter %qty% or more characters', 'enhanced select', 'woocommerce'), 'i18n_input_too_long_1' => _x('Please delete 1 character', 'enhanced select', 'woocommerce'), 'i18n_input_too_long_n' => _x('Please delete %qty% characters', 'enhanced select', 'woocommerce'), 'i18n_selection_too_long_1' => _x('You can only select 1 item', 'enhanced select', 'woocommerce'), 'i18n_selection_too_long_n' => _x('You can only select %qty% items', 'enhanced select', 'woocommerce'), 'i18n_load_more' => _x('Loading more results…', 'enhanced select', 'woocommerce'), 'i18n_searching' => _x('Searching…', 'enhanced select', 'woocommerce'), 'ajax_url' => admin_url('admin-ajax.php'), 'search_products_nonce' => wp_create_nonce('search-products'), 'search_customers_nonce' => wp_create_nonce('search-customers')));
wp_enqueue_style('woocommerce_admin_styles', WC()->plugin_url() . '/assets/css/admin.css', array(), WC_VERSION);
wp_enqueue_style('wc-setup', WC()->plugin_url() . '/assets/css/wc-setup.css', array('dashicons', 'install'), WC_VERSION);
wp_register_script('wc-setup', WC()->plugin_url() . '/assets/js/admin/wc-setup.min.js', array('jquery', 'wc-enhanced-select'), WC_VERSION);
wp_localize_script('wc-setup', 'wc_setup_params', array('locale_info' => json_encode(include WC()->plugin_path() . '/i18n/locale-info.php')));
if (!empty($_POST['save_step']) && isset($this->steps[$this->step]['handler'])) {
call_user_func($this->steps[$this->step]['handler']);
}
ob_start();
$this->setup_wizard_header();
$this->setup_wizard_steps();
$this->setup_wizard_content();
$this->setup_wizard_footer();
exit;
}
开发者ID:zengskie,项目名称:Heroku-WordPress-PostgreSQL,代码行数:28,代码来源:class-wc-admin-setup-wizard.php
示例3: filter_the_content
public function filter_the_content($content)
{
$ww_problem = false;
if (is_page('webwork')) {
$ww_problem = true;
} else {
$ww_problem = get_query_var('ww_problem');
}
if ($ww_problem) {
$content = '<div id="webwork-app"></div>';
wp_enqueue_script('webwork-app', plugins_url() . '/webwork/build/index.js');
$route_base = get_option('home');
$route_base = preg_replace('|https?://[^/]+/|', '', $route_base);
// @todo Centralize this logic.
$main_site_url = get_blog_option(1, 'home');
$rest_api_endpoint = trailingslashit($main_site_url) . 'wp-json/webwork/v1/';
// @todo Abstract.
$post_data = null;
$ww_problem_text = '';
if (!empty($_GET['post_data_key'])) {
$post_data = get_blog_option(1, $_GET['post_data_key']);
$ww_problem_text = base64_decode($post_data['pg_object']);
}
// @todo This is awful.
$clients = get_blog_option(1, 'webwork_clients');
$remote_course_url = array_search(get_current_blog_id(), $clients);
wp_localize_script('webwork-app', 'WWData', array('problem_id' => $ww_problem, 'problem_text' => $ww_problem_text, 'remote_course_url' => $remote_course_url, 'rest_api_nonce' => wp_create_nonce('wp_rest'), 'rest_api_endpoint' => $rest_api_endpoint, 'route_base' => trailingslashit($route_base) . 'webwork/', 'user_can_ask_question' => is_user_logged_in(), 'user_can_post_response' => is_user_logged_in(), 'user_can_vote' => is_user_logged_in()));
wp_enqueue_style('webwork-app', plugins_url() . '/webwork/assets/css/app.css');
wp_register_script('webwork-mathjax-loader', WEBWORK_PLUGIN_URL . '/assets/js/webwork-mathjax-loader.js');
$webwork_mathjax_loader_strings = array('mathjax_src' => esc_url('https://cdn.mathjax.org/mathjax/latest/unpacked/MathJax.js?config=TeX-MML-AM_HTMLorMML-full'));
wp_localize_script('webwork-mathjax-loader', 'WeBWorK_MathJax', $webwork_mathjax_loader_strings);
wp_enqueue_script('webwork-mathjax-loader');
}
return $content;
}
开发者ID:livinglab,项目名称:webwork-for-wordpress,代码行数:35,代码来源:Client.php
示例4: enqueueJavascripts
public function enqueueJavascripts($pageHookname)
{
if ($pageHookname === $this->adminConsolePageHookname) {
$jsDir = $this->config->getPluginUrl() . '/js';
$version = $this->config->getVersion();
$knockoutSuffix = '';
$suffix = '.min';
if (defined('WP_DEBUG') && WP_DEBUG) {
$knockoutSuffix = '.debug';
$suffix = '';
}
wp_register_script('knockout', $jsDir . '/deps/knockout-3.1.0' . $knockoutSuffix . '.js', array(), $version, false);
wp_enqueue_script('knockout');
wp_register_script('knockoutValidation', $jsDir . '/deps/knockout.validation' . $suffix . '.js', array('knockout'), $version, false);
wp_enqueue_script('knockoutValidation');
wp_register_script('autosize', $jsDir . '/deps/jquery.autosize' . $suffix . '.js', array('jquery'), $version, false);
wp_enqueue_script('autosize');
wp_register_script('chamameAdmin', $jsDir . '/admin' . $suffix . '.js', array('jquery', 'knockout', 'knockoutValidation', 'autosize'), $version, false);
wp_enqueue_script('chamameAdmin');
$ajaxUrl = str_replace(array('https:', 'http:'), '', admin_url('admin-ajax.php'));
$token = wp_create_nonce('chamameLiveChat');
$textDomain = $this->config->getTextDomain();
wp_localize_script('chamameAdmin', 'chamameParams', array('ajaxUrl' => $ajaxUrl, 'loggedIn' => $this->session->isLoggedIn(), 'conversationId' => $this->session->getActiveConversationId(), 'token' => $token, 'text' => array('error' => __('Something went wrong. Please try again', $textDomain))));
}
}
开发者ID:al-mamun,项目名称:chamame-live-chat,代码行数:25,代码来源:ChamameGuiAdmin.php
示例5: core_mods
function core_mods() {
if ( !is_admin() ) {
wp_deregister_script('jquery');
wp_register_script('jquery', ("//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"), false);
wp_enqueue_script('jquery');
}
}
开发者ID:neufuture,项目名称:HTML5-Reset-Wordpress-Theme,代码行数:7,代码来源:functions.php
示例6: InitClass
static function InitClass()
{
wp_enqueue_style(WPFB . '-admin', WPFB_PLUGIN_URI . 'css/admin.css', array(), WPFB_VERSION, 'all');
wp_register_script('jquery-deserialize', WPFB_PLUGIN_URI . 'bower_components/jquery-deserialize/dist/jquery.deserialize.min.js', array('jquery'), WPFB_VERSION);
if (isset($_GET['page'])) {
$page = $_GET['page'];
if ($page == 'wpfilebase_files') {
wp_enqueue_script('postbox');
wp_enqueue_style('dashboard');
} elseif ($page == 'wpfilebase' && isset($_GET['action']) && $_GET['action'] == 'sync') {
do_action('wpfilebase_sync');
wp_die("Filebase synced.");
}
}
add_action('wp_dashboard_setup', array(__CLASS__, 'AdminDashboardSetup'));
//wp_register_widget_control(WPFB_PLUGIN_NAME, "[DEPRECATED]".WPFB_PLUGIN_NAME .' '. __('File list','wp-filebase'), array(__CLASS__, 'WidgetFileListControl'), array('description' => __('DEPRECATED','wp-filebase')));
add_action('admin_print_scripts', array('WPFB_AdminLite', 'AdminPrintScripts'));
self::CheckChangedVer();
if (basename($_SERVER['PHP_SELF']) === "plugins.php") {
if (isset($_GET['wpfb-uninstall']) && current_user_can('edit_files')) {
update_option('wpfb_uninstall', !empty($_GET['wpfb-uninstall']) && $_GET['wpfb-uninstall'] != "0");
}
if (get_option('wpfb_uninstall')) {
function wpfb_uninstall_warning()
{
echo "\n\t\t\t\t<div id='wpfb-warning' class='updated fade'><p><strong>" . __('WP-Filebase will be uninstalled completely when deactivating the Plugin! All settings and File/Category Info will be deleted. Actual files in the upload directory will not be removed.', 'wp-filebase') . ' <a href="' . add_query_arg('wpfb-uninstall', '0') . '">' . __('Cancel') . "</a></strong></p></div>\n\t\t\t\t";
}
add_action('admin_notices', 'wpfb_uninstall_warning');
}
}
}
开发者ID:noxian,项目名称:WP-Filebase,代码行数:31,代码来源:AdminLite.php
示例7: hybrid_register_scripts
/**
* Registers JavaScript files for the framework. This function merely registers scripts with WordPress using
* the wp_register_script() function. It does not load any script files on the site. If a theme wants to register
* its own custom scripts, it should do so on the 'wp_enqueue_scripts' hook.
*
* @since 1.2.0
*/
function hybrid_register_scripts()
{
/* Register the 'drop-downs' script if the current theme supports 'hybrid-core-drop-downs'. */
if (current_theme_supports('hybrid-core-drop-downs')) {
wp_register_script('drop-downs', esc_url(apply_atomic('drop_downs_script', trailingslashit(HYBRID_JS) . 'drop-downs.js')), array('jquery'), '20110705', true);
}
}
开发者ID:rdbartlett,项目名称:kellyspencer.co.nz,代码行数:14,代码来源:media.php
示例8: show_tag_filter
/**
* Show the tag cloud
*/
public function show_tag_filter($shortcode_atts)
{
if (isset($shortcode_atts['show_tags']) && ($shortcode_atts['show_tags'] === false || (string) $shortcode_atts['show_tags'] == 'false')) {
return;
}
if (wp_count_terms('job_listing_tag') == 0) {
return;
}
wp_register_script('wp-job-manager-ajax-tag-filters', JOB_MANAGER_TAGS_PLUGIN_URL . '/assets/js/tag-filter.js', array('jquery'), '1.0', true);
$args_data = array('orderby' => 'count', 'order' => 'DESC');
$jobs_tags_data = get_terms('job_listing_tag', $args_data);
$queried_object = get_queried_object();
foreach ($jobs_tags_data as $key => $jobs_tag_data) {
if ($jobs_tag_data->count > 1) {
$jobs_txt = 'jobs';
$font_size = 2;
} else {
$jobs_txt = 'job';
$font_size = 1;
}
//if($queried_object->term_id == $jobs_tag_data->term_id){ $active_class = 'activee'; }
$anchor_data[] = '<a href="#" id="test_' . $key . '" "class="tag-link-' . $jobs_tag_data->term_id . ' ' . $active_class . ' show_bg_tag" title="' . $jobs_tag_data->count . ' ' . $jobs_txt . '" style="font-size: ' . $font_size . 'em;">' . $jobs_tag_data->name . '</a>';
}
$anchor_tag_data = array('anchor_tag_data' => $anchor_data);
//anchor_tag_data
wp_localize_script('wp-job-manager-ajax-tag-filters', 'anchor_tag_data_object', $anchor_tag_data);
wp_enqueue_script('wp-job-manager-ajax-tag-filters', JOB_MANAGER_TAGS_PLUGIN_URL . '/assets/js/tag-filter.js', array('jquery'), '1.0', true);
echo '<div class="filter_wide filter_by_tag">' . __('Filter by tag:', 'wp-job-manager-tags') . ' <span class="filter_by_tag_cloud"></span></div>';
}
开发者ID:vinodhip,项目名称:Function-22-Website,代码行数:32,代码来源:class-job-manager-job-tags-shortcodes.php
示例9: foundationpress_scripts
function foundationpress_scripts()
{
// Enqueue Main Stylesheet
wp_enqueue_style('Main Stylesheet', get_stylesheet_directory_uri() . '/css/foundation.css');
// Deregister the jquery version bundled with wordpress
wp_deregister_script('jquery');
// Modernizr is used for polyfills and feature detection. Must be placed in header. (Not required)
wp_register_script('modernizr', get_template_directory_uri() . '/js/vendor/modernizr.js', array(), '2.8.3', false);
// Fastclick removes the 300ms delay on click events in mobile environments. Must be placed in header. (Not required)
wp_register_script('fastclick', get_template_directory_uri() . '/js/vendor/fastclick.js', array(), '1.0.0', false);
// CDN hosted jQuery placed in the header, as some plugins require that jQuery is loaded in the header.
wp_enqueue_script('jquery', '//ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js', array(), '2.1.0', false);
// Self hosted jQuery placed in the footer. (Comment the script above and uncomment the script below if you want to switch).
//wp_register_script( 'jquery', get_template_directory_uri() . '/js/vendor/jquery.js', array(), '2.1.3', true );
// If you'd like to cherry-pick the foundation components you need in your project, head over to Gruntfile.js and see lines 67-88
// It's a good idea to do this, performance-wise. No need to load everything if you're just going to use the grid anyway, you know :)
wp_register_script('foundation', get_template_directory_uri() . '/js/foundation.js', array('jquery'), '5.5.1', true);
wp_register_script('troispointszero', get_template_directory_uri() . '/js/custom/troispointzero.js', array('jquery'), '1.0');
// Enqueue all registered scripts
wp_enqueue_script('modernizr');
wp_enqueue_script('fastclick');
wp_enqueue_script('jquery');
wp_enqueue_script('foundation');
wp_enqueue_script('troispointszero');
}
开发者ID:alexandrethiebaut,项目名称:ntsc,代码行数:25,代码来源:enqueue-scripts.php
示例10: init
static function init()
{
add_action('wp_enqueue_scripts', array('P2_JS', 'enqueue_scripts'));
add_action('wp_enqueue_scripts', array('P2_JS', 'enqueue_styles'));
add_action('wp_head', array('P2_JS', 'print_options'), 1);
/**
* Register scripts
*/
wp_register_script('jeditable', P2_JS_URL . '/jquery.jeditable.js', array('jquery'), '1.6.2-rc2');
wp_register_script('caret', P2_JS_URL . '/caret.js', array('jquery'), '20101025');
wp_register_script('jquery-ui-autocomplete-html', P2_JS_URL . '/jquery.ui.autocomplete.html.js', array('jquery-ui-autocomplete'), '20101025');
wp_register_script('jquery-ui-autocomplete-multiValue', P2_JS_URL . '/jquery.ui.autocomplete.multiValue.js', array('jquery-ui-autocomplete'), '20110405');
wp_register_script('jquery-ui-autocomplete-match', P2_JS_URL . '/jquery.ui.autocomplete.match.js', array('jquery-ui-autocomplete', 'caret'), '20110405');
/**
* Bundle containing scripts included when the user is logged in.
* Includes, in order:
* jeditable, caret, jquery-ui-autocomplete,
* jquery-ui-autocomplete-html, jquery-ui-autocomplete-multiValue,
* jquery-ui-autocomplete-match
*
* Build the bundle with the bin/bundle-user-js shell script.
*
* @TODO: Improve bundle building/dependency process.
*/
wp_register_script('p2-user-bundle', P2_JS_URL . '/p2.user.bundle.js', array('jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position'), '20130819');
wp_register_script('scrollit', P2_JS_URL . '/jquery.scrollTo-min.js', array('jquery'), '20120402');
wp_register_script('wp-locale', P2_JS_URL . '/wp-locale.js', array(), '20130819');
// Media upload script registered based on info in script-loader.
wp_register_script('media-upload', '/wp-admin/js/media-upload.js', array('thickbox'), '20110113');
wp_register_script('p2-spin', P2_JS_URL . '/spin.js', array('jquery'), '20120704');
}
开发者ID:cabelotaina,项目名称:redelivre,代码行数:31,代码来源:js.php
示例11: dazake_load_script
/**
* Ladda script
*/
function dazake_load_script()
{
if (!is_admin()) {
/**
* Deregister wordpress scripts
*/
wp_deregister_script('jquery');
/**
* wp_register_script( $handle, $src, $deps, $ver, $in_footer );
*/
wp_register_script('jquery', 'http://lib.sinaapp.com/js/jquery/1.7.2/jquery.min.js');
wp_register_script('modernizr', get_template_directory_uri() . '/js/libs/modernizr.js');
wp_register_script('bootstrap', get_template_directory_uri() . '/js/libs/bootstrap/js/bootstrap.min.js');
wp_register_script('less', get_template_directory_uri() . '/js/libs/less.js');
wp_register_script('main', get_template_directory_uri() . '/js/main.js');
/**
* Laddar skripten vi registrerat ovan.
*/
wp_enqueue_script('jquery');
wp_enqueue_script('modernizr');
wp_enqueue_script('bootstrap');
wp_enqueue_script('less');
wp_enqueue_script('main');
/**
* load stylesheet
*/
wp_enqueue_style('style', get_stylesheet_uri());
wp_enqueue_style('bootstrap', get_template_directory_uri() . '/js/libs/bootstrap/css/bootstrap.min.css');
wp_enqueue_style('bootstrap-responsive', get_template_directory_uri() . '/js/libs/bootstrap/css/bootstrap-responsive.min.css');
}
}
开发者ID:joaosigno,项目名称:dazake-job,代码行数:34,代码来源:functions.php
示例12: wen_business_custom_customize_enqueue_scripts
function wen_business_custom_customize_enqueue_scripts()
{
wp_register_script('wen_business_customizer_button', get_template_directory_uri() . '/assets/js/customizer-button.js', array('customize-controls'), '20130508', true);
$data = array('updrade_button_text' => __('Upgrade To Pro', 'wen-business'), 'updrade_button_link' => esc_url('http://catchthemes.com/themes/wen-business-pro'));
wp_localize_script('wen_business_customizer_button', 'WEN_Business_Customizer_Object', $data);
wp_enqueue_script('wen_business_customizer_button');
}
开发者ID:suskr50,项目名称:sc-profile,代码行数:7,代码来源:customizer.php
示例13: child_add_scripts
function child_add_scripts()
{
if (is_page('bps')) {
wp_register_script('bps-script', '/bps.js');
wp_enqueue_script('bps-script');
}
}
开发者ID:b0blee,项目名称:BeatsPerSecond,代码行数:7,代码来源:functions.php
示例14: json_api_client_js
/**
* Plugin Name: WP-API Client JS
*/
function json_api_client_js()
{
$scripts = wp_scripts();
$src = plugins_url('build/js/wp-api.js', __FILE__);
if (isset($scripts->registered['wp-api'])) {
$scripts->registered['wp-api']->src = $src;
} else {
wp_register_script('wp-api', $src, array('jquery', 'underscore', 'backbone'), '1.0', true);
}
/**
* @var \WP_REST_Server $wp_rest_server
*/
global $wp_rest_server;
if (empty($wp_rest_server)) {
/** This filter is documented in wp-includes/rest-api.php */
$wp_rest_server_class = apply_filters('wp_rest_server_class', 'WP_REST_Server');
$wp_rest_server = new $wp_rest_server_class();
/** This filter is documented in wp-includes/rest-api.php */
do_action('rest_api_init', $wp_rest_server);
}
$schema_request = new WP_REST_Request('GET', '/wp/v2');
$schema_response = $wp_rest_server->dispatch($schema_request);
$schema = null;
if (!$schema_response->is_error()) {
$schema = $schema_response->get_data();
}
$settings = array('root' => esc_url_raw(get_rest_url()), 'nonce' => wp_create_nonce('wp_rest'), 'versionString' => 'wp/v2/', 'schema' => $schema);
wp_localize_script('wp-api', 'wpApiSettings', $settings);
}
开发者ID:vickoman,项目名称:client-js,代码行数:32,代码来源:client-js.php
示例15: add_scripts_after_footer
function add_scripts_after_footer()
{
// Register the script like this for a plugin:
//wp_register_script( 'custom-script', plugins_url( '/js/custom-script.js', __FILE__ ) );
// or
// Register the script like this for a theme:
wp_register_script('jquery1.7', "https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js", false);
wp_register_script('bootstrap-alert', get_template_directory_uri() . '/js/bootstrap-alert.js');
wp_register_script('bootstrap-button', get_template_directory_uri() . '/js/bootstrap-button.js');
wp_register_script('bootstrap-carousel', get_template_directory_uri() . '/js/bootstrap-carousel.js');
wp_register_script('bootstrap-collapse', get_template_directory_uri() . '/js/bootstrap-collapse.js');
wp_register_script('bootstrap-dropdown', get_template_directory_uri() . '/js/bootstrap-dropdown.js');
wp_register_script('bootstrap-modal', get_template_directory_uri() . '/js/bootstrap-modal.js');
wp_register_script('bootstrap-popover', get_template_directory_uri() . '/js/bootstrap-popover.js');
wp_register_script('bootstrap-scrollspy', get_template_directory_uri() . '/js/bootstrap-scrollspy.js');
wp_register_script('bootstrap-tab', get_template_directory_uri() . '/js/bootstrap-tab.js');
wp_register_script('bootstrap-tooltip', get_template_directory_uri() . '/js/bootstrap-tooltip.js');
wp_register_script('bootstrap-transition', get_template_directory_uri() . '/js/bootstrap-transition.js');
wp_register_script('bootstrap-typeahead', get_template_directory_uri() . '/js/bootstrap-typeahead.js');
// For either a plugin or a theme, you can then enqueue the script:
wp_enqueue_script('jquery1.7');
wp_enqueue_script('bootstrap-transition');
wp_enqueue_script('bootstrap-alert');
wp_enqueue_script('bootstrap-modal');
wp_enqueue_script('bootstrap-dropdown');
wp_enqueue_script('bootstrap-scrollspy');
wp_enqueue_script('bootstrap-tab');
wp_enqueue_script('bootstrap-tooltip');
wp_enqueue_script('bootstrap-popover');
wp_enqueue_script('bootstrap-button');
wp_enqueue_script('bootstrap-collapse');
wp_enqueue_script('bootstrap-carousel');
wp_enqueue_script('bootstrap-typeahead');
}
开发者ID:roychoo,项目名称:twitterBSWPtheme,代码行数:34,代码来源:functions.php
示例16: enqueue_styles_scripts
/**
* Enqueue styles and scripts
*
* @access public
* @return void
* @since 1.0.0
*/
public function enqueue_styles_scripts()
{
$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
wp_register_script('yith_wcas_jquery-autocomplete', YITH_WCAS_URL . 'assets/js/devbridge-jquery-autocomplete' . $suffix . '.js', array('jquery'), '1.2.7', true);
$css = file_exists(get_stylesheet_directory() . '/woocommerce/yith_ajax_search.css') ? get_stylesheet_directory_uri() . '/woocommerce/yith_ajax_search.css' : YITH_WCAS_URL . 'assets/css/yith_wcas_ajax_search.css';
wp_enqueue_style('yith_wcas_frontend', $css);
}
开发者ID:shubham79,项目名称:Jhintaak,代码行数:14,代码来源:class.yith-wcas-frontend.php
示例17: admin_enqueue_scripts
/**
* Enqueue scripts and styles
*
* @return void
*/
static function admin_enqueue_scripts()
{
$url = RWMB_CSS_URL . 'jqueryui';
wp_register_style('jquery-ui-core', "{$url}/jquery.ui.core.css", array(), '1.8.17');
wp_register_style('jquery-ui-theme', "{$url}/jquery.ui.theme.css", array(), '1.8.17');
wp_register_style('jquery-ui-datepicker', "{$url}/jquery.ui.datepicker.css", array('jquery-ui-core', 'jquery-ui-theme'), '1.8.17');
wp_register_style('jquery-ui-slider', "{$url}/jquery.ui.slider.css", array('jquery-ui-core', 'jquery-ui-theme'), '1.8.17');
wp_enqueue_style('jquery-ui-timepicker', "{$url}/jquery-ui-timepicker-addon.css", array('jquery-ui-datepicker', 'jquery-ui-slider'), '0.9.7');
wp_register_script('jquery-ui-timepicker', RWMB_JS_URL . 'jqueryui/jquery-ui-timepicker-addon.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), '0.9.7', true);
// Load localized scripts
$locale = str_replace('_', '-', get_locale());
$date_path = 'jqueryui/datepicker-i18n/jquery.ui.datepicker-' . $locale . '.js';
$time_path = 'jqueryui/timepicker-i18n/jquery-ui-timepicker-' . $locale . '.js';
$deps = array('jquery-ui-datepicker', 'jquery-ui-timepicker');
if (file_exists(RWMB_DIR . 'js/' . $date_path)) {
wp_register_script('jquery-ui-datepicker-i18n', RWMB_JS_URL . $date_path, array('jquery-ui-datepicker'), '1.8.17', true);
$deps[] = 'jquery-ui-datepicker-i18n';
}
if (file_exists(RWMB_DIR . 'js/' . $time_path)) {
wp_register_script('jquery-ui-timepicker-i18n', RWMB_JS_URL . $time_path, array('jquery-ui-timepicker'), '1.8.17', true);
$deps[] = 'jquery-ui-timepicker-i18n';
}
wp_enqueue_script('rwmb-datetime', RWMB_JS_URL . 'datetime.js', $deps, RWMB_VER, true);
wp_localize_script('rwmb-datetime', 'RWMB_Datetimepicker', array('lang' => $locale));
}
开发者ID:RDePoppe,项目名称:luminaterealestate,代码行数:30,代码来源:datetime.php
示例18: _cfs_admin_script
function _cfs_admin_script()
{
wp_register_style('cfs-style', plugins_url('css/cfs_admin.css', dirname(__FILE__)));
wp_enqueue_style('cfs-style');
wp_register_script('cfs-script', plugins_url('js/cfs_admin.js', dirname(__FILE__)), array(), '1.0.0', true);
wp_enqueue_script('cfs-script');
}
开发者ID:bobstermyang,项目名称:communityfoodshare,代码行数:7,代码来源:functions.php
示例19: takeaway_register_woo_radio_button_scripts
function takeaway_register_woo_radio_button_scripts()
{
wp_deregister_script('wc-add-to-cart-variation');
wp_dequeue_script('wc-add-to-cart-variation');
wp_register_script('takeaway-add-to-cart-variation', UOU_JS . 'add-to-cart-variation.min.js', array('jquery'), $ver = false, true);
wp_enqueue_script('takeaway-add-to-cart-variation');
}
开发者ID:ankitparsanaa,项目名称:foodapp,代码行数:7,代码来源:script.php
示例20: spacious_scripts_styles_method
/**
* Register jquery scripts
*/
function spacious_scripts_styles_method()
{
/**
* Loads our main stylesheet.
*/
wp_enqueue_style('spacious_style', get_stylesheet_uri());
if (of_get_option('spacious_color_skin', 'light') == 'dark') {
wp_enqueue_style('spacious_dark_style', SPACIOUS_CSS_URL . '/dark.css');
}
/**
* Adds JavaScript to pages with the comment form to support
* sites with threaded comments (when in use).
*/
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
/**
* Register JQuery cycle js file for slider.
*/
wp_register_script('jquery_cycle', SPACIOUS_JS_URL . '/jquery.cycle.all.min.js', array('jquery'), '2.9999.5', true);
// wp_register_style( 'google_fonts', 'http://fonts.googleapis.com/css?family=Lato' );
/**
* Enqueue Slider setup js file.
*/
if (is_home() || is_front_page() && of_get_option('spacious_activate_slider', '0') == '1') {
wp_enqueue_script('spacious_slider', SPACIOUS_JS_URL . '/spacious-slider-setting.js', array('jquery_cycle'), false, true);
}
wp_enqueue_script('spacious-navigation', SPACIOUS_JS_URL . '/navigation.js', array('jquery'), false, true);
wp_enqueue_script('spacious-custom', SPACIOUS_JS_URL . '/spacious-custom.js', array('jquery'));
wp_enqueue_style('google_fonts');
$spacious_user_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
if (preg_match('/(?i)msie [1-8]/', $spacious_user_agent)) {
wp_enqueue_script('html5', SPACIOUS_JS_URL . '/html5.js', true);
}
}
开发者ID:achrafse,项目名称:CitizenWatt-WordPress-theme,代码行数:38,代码来源:functions.php
注:本文中的wp_register_script函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论