本文整理汇总了PHP中wp_enqueue_script函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_enqueue_script函数的具体用法?PHP wp_enqueue_script怎么用?PHP wp_enqueue_script使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_enqueue_script函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: localedge_scripts_and_styles
function localedge_scripts_and_styles()
{
global $wp_styles;
// call global $wp_styles variable to add conditional wrapper around ie stylesheet the WordPress way
// modernizr (without media query polyfill)
wp_enqueue_script('localedge-modernizr', '//cdnjs.cloudflare.com/ajax/libs/modernizr/2.7.1/modernizr.min.js', false, null);
// respondjs
wp_enqueue_script('localedge-respondjs', '//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.js', false, null);
// register main stylesheet
wp_enqueue_style('localedge-stylesheet', get_stylesheet_directory_uri() . '/css/style.css', array(), '', 'all');
// ie-only style sheet
wp_enqueue_style('localedge-ie-only', get_stylesheet_directory_uri() . '/css/ie.css', array(), '');
$wp_styles->add_data('localedge-ie-only', 'conditional', 'lt IE 9');
// add conditional wrapper around ie stylesheet
//Magnific Popup (LightBox)
wp_enqueue_script('localedge-magnific-popup-js', '//cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/0.9.9/jquery.magnific-popup.min.js', array('jquery'), '0.9.9', true);
//Font Awesome (icon set)
wp_enqueue_style('localedge-font-awesome', '//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.0.3/css/font-awesome.min.css', array(), '4.0.3');
// iCheck (better radio and checkbox inputs)
wp_enqueue_script('localedge-icheck', '//cdnjs.cloudflare.com/ajax/libs/iCheck/1.0.1/icheck.min.js', array('jquery'), '1.0.1', true);
//Chosen - http://harvesthq.github.io/chosen/
wp_enqueue_script('chosen-js', '//cdnjs.cloudflare.com/ajax/libs/chosen/1.1.0/chosen.jquery.min.js', array('jquery'), '1.1.0', true);
// comment reply script for threaded comments
if (is_singular() and comments_open() and get_option('thread_comments') == 1) {
wp_enqueue_script('comment-reply');
}
//adding scripts file in the footer
wp_enqueue_script('localedge-js', get_stylesheet_directory_uri() . '/js/scripts.js', array('jquery'), '', true);
}
示例2: sectioned_page_output
function sectioned_page_output()
{
wp_enqueue_script('sticky', WP_PLUGIN_URL . '/' . plugin_dir_path('msd-specialty-pages/msd-specialty-pages.php') . '/lib/js/jquery.sticky.js', array('jquery'), FALSE, TRUE);
global $post, $subtitle_metabox, $sectioned_page_metabox, $nav_ids;
$i = 0;
$meta = $sectioned_page_metabox->the_meta();
if (is_object($sectioned_page_metabox)) {
while ($sectioned_page_metabox->have_fields('sections')) {
$layout = $sectioned_page_metabox->get_the_value('layout');
switch ($layout) {
case "three-boxes":
break;
default:
$sections[] = self::default_output($meta['sections'][$i], $i);
break;
}
$i++;
}
//close while
print '<div class="sectioned-page-wrapper">';
print implode("\n", $sections);
print '</div>';
}
//clsoe if
}
示例3: admin_google_font_scripts
function admin_google_font_scripts()
{
wp_register_script('ultimate-google-fonts-script', plugins_url("../admin/js/google-fonts-admin.js", __FILE__), array('jquery'));
wp_enqueue_script('ultimate-google-fonts-script');
wp_register_style('ultimate-google-fonts-style', plugins_url("../admin/css/google-fonts-admin.css", __FILE__));
wp_enqueue_style('ultimate-google-fonts-style');
}
示例4: _enqueue_static
/**
* @internal
* {@inheritdoc}
*/
protected function _enqueue_static($id, $option, $data)
{
wp_enqueue_style('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/css/styles.css'), array(), fw()->manifest->get_version());
wp_enqueue_script('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/js/scripts.js'), array('fw-events', 'jquery-ui-sortable'), fw()->manifest->get_version(), true);
fw()->backend->enqueue_options_static($option['box-options']);
return true;
}
示例5: ox_adding_scripts
function ox_adding_scripts()
{
if (!function_exists('is_login_page')) {
function is_login_page()
{
return !strncmp($_SERVER['REQUEST_URI'], '/wp-login.php', strlen('/wp-login.php'));
}
}
if (!is_admin() && !is_login_page()) {
/*removed wp-embed.min.js*/
wp_deregister_script('wp-embed');
/*jquery*/
wp_deregister_script('jquery');
$infooter = !is_page(array($order_form_pages)) ? true : false;
wp_register_script('jquery', "http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js", false, '1.11.3', $infooter);
wp_enqueue_script('jquery');
/*bootstrap*/
wp_enqueue_style('bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css');
/*slicknav menu*/
wp_enqueue_script('slicknav', get_template_directory_uri() . '/js/jquery.slicknav.min.js', array('jquery'), '', true);
/*bxslider*/
wp_enqueue_style('bxslider', get_template_directory_uri() . '/css/jquery.bxslider.min.css');
wp_enqueue_script('bxslider', get_template_directory_uri() . '/js/jquery.bxslider.min.js', array('jquery'), '', true);
/*zopim chat*/
wp_enqueue_script('zopim', get_template_directory_uri() . '/js/zopimClear.js', array('jquery'), '', true);
/*custom css*/
wp_enqueue_style('custom', get_template_directory_uri() . '/style.css', array('bootstrap'));
/*custom js*/
wp_enqueue_script('custom', get_template_directory_uri() . '/js/custom.js', array('jquery'), '', true);
}
}
示例6: twentyhua_10_scripts_styles
function twentyhua_10_scripts_styles()
{
// bootstrap
wp_enqueue_script('twentyhua-script', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '20150701', true);
wp_enqueue_style('twentyhua-style', get_template_directory_uri() . '/css/bootstrap.min.css', array(), '20150701');
wp_enqueue_style('twentyhua-style', get_template_directory_uri() . '/css/bootstrap-theme.min.css', array(), '20150701');
}
示例7: sfsi_footerFeedbackScript
function sfsi_footerFeedbackScript()
{
wp_enqueue_style('wp-pointer');
wp_enqueue_script('wp-pointer');
wp_enqueue_script('utils');
// for user settings
$html = '<div>';
$html .= '<label>Optional: Please tell us why you deactivate our plugin so that we can make it better!</label>';
$html .= '<textarea id="sfsi_feedbackMsg" name="reason"></textarea>';
$html .= '</div>';
?>
<script type="text/javascript">
jQuery('#social-media-and-share-icons-ultimate-social-media .deactivate a').click(function(){
jQuery('#social-media-and-share-icons-ultimate-social-media .deactivate a').pointer({
content: '<form method="post" id="sfsi_feedbackForm"><?php
echo $html;
?>
<div><input type="button" name="sfsi_sendFeedback" value="Submit & Deactivate" class="button primary-button" /></div><img id="sfsi_loadergif" src="<?php
echo site_url() . "/wp-includes/images/spinner.gif";
?>
" /></form>',
position: {
edge:'top',
align:'left',
},
close: function() {
//
}
}).pointer('open');
return false;
});
jQuery("body").on("click","input[name='sfsi_sendFeedback']", function(){
var ajaxurl = '<?php
echo admin_url('admin-ajax.php');
?>
';
var deactivateUrl = jQuery('#social-media-and-share-icons-ultimate-social-media .deactivate a').attr('href');
var e = {
action:"sfsi_feedbackForm",
email: '<?php
echo get_option("admin_email");
?>
',
msg:jQuery("#sfsi_feedbackMsg").val()
};
jQuery("#sfsi_loadergif").show();
jQuery.ajax({
url:ajaxurl,
type:"post",
data:e,
success:function(responce) {
//alert(responce);
jQuery("#sfsi_loadergif").hide();
window.location.href = deactivateUrl;
}
});
});
</script>
<?php
}
示例8: 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');
}
}
}
示例9: 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);
}
}
示例10: genesis_responsive_slider_settings_scripts
/**
* Loads the scripts required for the settings page
*/
function genesis_responsive_slider_settings_scripts()
{
wp_enqueue_script('common');
wp_enqueue_script('wp-lists');
wp_enqueue_script('postbox');
wp_enqueue_script('genesis_responsive_slider_admin_scripts', plugins_url('js/admin.js', __FILE__), array('jquery'), GENESIS_RESPONSIVE_SLIDER_VERSION, TRUE);
}
示例11: enqueue_global_scripts
/**
* Enqueue required global styles and scirpts
*
* @access public
* @since 0.0.0
*
* @see wp_enqueue_style()
*
* @return void
*/
public function enqueue_global_scripts()
{
//enqueue styles
wp_enqueue_style('wfg-styles', plugins_url('/css/wfg-styles.css', dirname(__FILE__)));
//enqueue scripts
wp_enqueue_script('wfg-scripts', plugins_url('/js/wfg-scripts.js', dirname(__FILE__)), array('jquery'));
}
开发者ID:ankitpokhrel,项目名称:woocommerce-multiple-free-gift,代码行数:17,代码来源:Woocommerce_Multiple_Free_Gift.class.php
示例12: rsttst_load_styles
function rsttst_load_styles()
{
if (!is_admin()) {
wp_enqueue_style('rest-styles', plugins_url('assets/rest-styles.css', __FILE__));
wp_enqueue_script('rest-scripts', plugins_url('assets/rest-scripts.js', __FILE__), array('jquery'), 1.0);
}
}
示例13: _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');
}
示例14: render_content
/**
* Display the font control.
*
* @since 1.0.0
*/
function render_content()
{
$v = $this->value();
$values = json_decode($v);
wp_enqueue_script('json2');
$font_options = isset($this->font_options) ? $this->font_options : array();
?>
<?php
if ($this->show_label && !empty($this->label)) {
?>
<span class="customize-control-title themify-control-title"><?php
echo esc_html($this->label);
?>
</span>
<?php
}
?>
<?php
$this->render_fonts($values, $font_options);
?>
<input <?php
$this->link();
?>
value='<?php
echo esc_attr($v);
?>
' type="hidden" class="<?php
echo esc_attr($this->type);
?>
_control themify-customizer-value-field"/>
<?php
}
示例15: wpcf_pr_admin_post_init_action
/**
* Init function.
*
* Enqueues styles and scripts on post edit page.
*
* @param type $post_type
* @param type $post
* @param type $groups
* @param type $wpcf_active
*/
function wpcf_pr_admin_post_init_action($post_type, $post, $groups, $wpcf_active)
{
// See if any data
$has = wpcf_pr_admin_get_has($post_type);
$belongs = wpcf_pr_admin_get_belongs($post_type);
/*
* Enqueue styles and scripts
*/
if (!empty($has) || !empty($belongs)) {
$output = wpcf_pr_admin_post_meta_box_output($post, array('post_type' => $post_type, 'has' => $has, 'belongs' => $belongs));
add_meta_box('wpcf-post-relationship', __('Post Relationship', 'wpcf'), 'wpcf_pr_admin_post_meta_box', $post_type, 'normal', 'default', array('output' => $output));
if (!empty($output)) {
wp_enqueue_script('wpcf-post-relationship', WPCF_EMBEDDED_RELPATH . '/resources/js/post-relationship.js', array('jquery', 'select2'), WPCF_VERSION);
wp_enqueue_style('wpcf-post-relationship', WPCF_EMBEDDED_RELPATH . '/resources/css/post-relationship.css', array(), WPCF_VERSION);
if (!$wpcf_active) {
wpcf_enqueue_scripts();
wp_enqueue_style('wpcf-pr-post', WPCF_EMBEDDED_RES_RELPATH . '/css/fields-post.css', array(), WPCF_VERSION);
wp_enqueue_script('wpcf-form-validation', WPCF_EMBEDDED_RES_RELPATH . '/js/' . 'jquery-form-validation/jquery.validate.min.js', array('jquery'), WPCF_VERSION);
wp_enqueue_script('wpcf-form-validation-additional', WPCF_EMBEDDED_RES_RELPATH . '/js/' . 'jquery-form-validation/additional-methods.min.js', array('jquery'), WPCF_VERSION);
}
wpcf_admin_add_js_settings('wpcf_pr_del_warning', '\'' . __('Are you sure about deleting this post?', 'wpcf') . '\'');
wpcf_admin_add_js_settings('wpcf_pr_pagination_warning', '\'' . __('If you continue without saving your changes, they might get lost.', 'wpcf') . '\'');
}
}
}