本文整理汇总了PHP中wp_enqueue_media函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_enqueue_media函数的具体用法?PHP wp_enqueue_media怎么用?PHP wp_enqueue_media使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_enqueue_media函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wpum_admin_cssjs
/**
* Loads the plugin admin assets files
*
* @since 1.0.0
* @return void
*/
function wpum_admin_cssjs()
{
$js_dir = WPUM_PLUGIN_URL . 'assets/js/';
$css_dir = WPUM_PLUGIN_URL . 'assets/css/';
// Use minified libraries if SCRIPT_DEBUG is turned off
$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
// Styles & scripts
wp_register_style('wpum-admin', $css_dir . 'wp_user_manager' . $suffix . '.css', WPUM_VERSION);
wp_register_style('wpum-admin-general', WPUM_PLUGIN_URL . 'assets/css/wp_user_manager_admin_general.css', WPUM_VERSION);
wp_register_style('wpum-select2', WPUM_PLUGIN_URL . 'assets/select2/css/select2.css', WPUM_VERSION);
wp_register_script('wpum-select2', WPUM_PLUGIN_URL . 'assets/select2/js/select2.min.js', 'jQuery', WPUM_VERSION, true);
wp_register_script('wpum-serializeJSON', WPUM_PLUGIN_URL . 'assets/js/vendor/jquery.serializeJSON.js', 'jQuery', WPUM_VERSION, true);
wp_register_script('wpum-admin-js', $js_dir . 'wp_user_manager_admin' . $suffix . '.js', 'jQuery', WPUM_VERSION, true);
// Enquery styles and scripts anywhere needed
wp_enqueue_style('wpum-admin-general');
// Enqueue styles & scripts on admin page only
$screen = get_current_screen();
wp_enqueue_script('wpum-admin-js');
// Load styles only on required pages.
if ($screen->base == 'users_page_wpum-settings' || $screen->id == 'wpum_directory' || $screen->base == 'users_page_wpum-edit-field' || $screen->base == 'users_page_wpum-profile-fields') {
wp_enqueue_script('wpum-select2');
wp_enqueue_style('wpum-admin');
wp_enqueue_style('wpum-select2');
wp_enqueue_script('accordion');
wp_enqueue_media();
if (isset($_GET['tab']) && $_GET['tab'] == 'default_fields' && $screen->base == 'users_page_wpum-settings') {
wp_enqueue_script('jquery-ui-sortable');
}
if ($screen->base == 'users_page_wpum-custom-fields-editor') {
wp_enqueue_script('wpum-serializeJSON');
}
}
// Backend JS Settings
wp_localize_script('wpum-admin-js', 'wpum_admin_js', array('ajax' => admin_url('admin-ajax.php'), 'confirm' => __('Are you sure you want to do this? This action cannot be reversed.', 'wpum'), 'use_this_file' => __('Use This File', 'wpum'), 'upload_title' => __('Upload or select a file', 'wpum')));
}
示例2: enqueue_admin_scripts
public function enqueue_admin_scripts()
{
if (get_current_screen()->id == $this->plugin_screen_hook_suffix) {
wp_enqueue_script($this->plugin_slug . '-admin-script', get_stylesheet_directory_uri() . '/video-player/js/progression-admin.js', array('jquery', 'wp-color-picker'), $this->version);
}
wp_enqueue_media();
}
示例3: emg_load_wp_enqueue
function emg_load_wp_enqueue()
{
if (get_post_type(get_the_ID()) == 'easymediagallery') {
$eparams = array('pcnt' => emg_pcnt(), 'psts' => get_post_status(get_the_ID()), 'pcurtp' => get_post_meta(get_the_ID(), 'easmedia_metabox_media_type', true));
wp_localize_script('cpscript', 'easyMeta', $eparams);
if (EMG_WP_VER == "g35") {
wp_enqueue_media();
}
wp_enqueue_script('jquery-multi-sel');
wp_enqueue_style('jquery-multiselect-css');
wp_enqueue_style('jquery-ui-themes-redmond');
wp_enqueue_style('emg-bootstrap-css');
wp_enqueue_script('jquery-ui');
wp_enqueue_script('jquery-effects-highlight');
wp_enqueue_script('easymedia-jplayer-js', plugins_url('js/jplayer/jquery.jplayer.min.js', __FILE__));
wp_enqueue_script('cpscript');
wp_enqueue_script('jquery-i-button', plugins_url('js/jquery/jquery.ibutton.js', __FILE__));
wp_enqueue_style('metabox-ibuttoneditor', plugins_url('css/ibutton.css', __FILE__), false, EASYMEDIA_VERSION);
wp_enqueue_style('easymedia-jplayer-css', plugins_url('css/jplayer/skin/pink.flag/jplayer.pink.flag.css', __FILE__), false, EASYMEDIA_VERSION);
wp_enqueue_style('jquery-messi-css');
wp_enqueue_script('jquery-messi-js');
wp_enqueue_script('emg-bootstrap-js');
wp_enqueue_script('easymedia-metascript', plugins_url('functions/metabox/metabox.js', __FILE__));
// @since 1.3.10 >
if (easy_get_option('easymedia_disen_autoupdt') != '1' && is_admin()) {
add_action('admin_notices', 'easmedia_update_notify');
}
}
}
示例4: automobile_theme_options_scripts
/**
* Include scripts to the options page only
*/
function automobile_theme_options_scripts()
{
if (!did_action('wp_enqueue_media')) {
wp_enqueue_media();
}
wp_enqueue_script('automobile_upload', plugins_url('/js/upload.js', __FILE__));
}
示例5: enqueueScripts
/**
* Enqueue admin scripts & styles
*/
function enqueueScripts()
{
if (get_post_type() == 'wpdmpro' || in_array(wpdm_query_var('page'), array('settings', 'emails', 'wpdm-stats', 'templates', 'importable-files', 'wpdm-addons', 'orders', 'pp-license'))) {
wp_enqueue_script('jquery');
wp_enqueue_script('jquery-form');
wp_enqueue_script('jquery-ui-core');
wp_enqueue_script('jquery-ui-tabs');
wp_enqueue_script('jquery-ui-datepicker');
wp_enqueue_script('jquery-ui-slider');
wp_enqueue_script('jquery-ui-sortable');
wp_enqueue_script('jquery-ui-timepicker', WPDM_BASE_URL . 'assets/js/jquery-ui-timepicker-addon.js', array('jquery', 'jquery-ui-core', 'jquery-ui-datepicker', 'jquery-ui-slider'));
wp_enqueue_style('icons', plugins_url() . '/download-manager/assets/css/icons.css');
wp_enqueue_script('thickbox');
wp_enqueue_style('thickbox');
wp_enqueue_script('media-upload');
wp_enqueue_media();
wp_enqueue_script('jquery-choosen', plugins_url('/download-manager/assets/js/chosen.jquery.min.js'), array('jquery'));
wp_enqueue_style('choosen-css', plugins_url('/download-manager/assets/css/chosen.css'));
wp_enqueue_style('jqui-css', plugins_url('/download-manager/assets/jqui/theme/jquery-ui.css'));
wp_enqueue_script('wpdm-bootstrap', plugins_url('/download-manager/assets/bootstrap/js/bootstrap.min.js'), array('jquery'));
wp_enqueue_script('wpdm-admin', plugins_url('/download-manager/assets/js/wpdm-admin.js'), array('jquery'));
wp_enqueue_style('font-awesome', WPDM_BASE_URL . 'assets/font-awesome/css/font-awesome.min.css');
wp_enqueue_style('wpdm-bootstrap', plugins_url('/download-manager/assets/bootstrap/css/bootstrap.css'));
wp_enqueue_style('wpdm-bootstrap-theme', plugins_url('/download-manager/assets/bootstrap/css/bootstrap-theme.min.css'));
wp_enqueue_style('wpdm-admin-styles', plugins_url('/download-manager/assets/css/admin-styles.css'));
}
}
示例6: sunset_load_admin_scripts
function sunset_load_admin_scripts($hook)
{
//echo $hook;
//register css admin section
wp_register_style('raleway-admin', 'https://fonts.googleapis.com/css?family=Raleway:200,300,500');
wp_register_style('sunset_admin', get_template_directory_uri() . '/css/sunset.admin.css', array(), '1.0.0', 'all');
//register js admin section
wp_register_script('sunset-admin-script', get_template_directory_uri() . '/js/sunset.admin.js', array('jquery'), '1.0.0', true);
$pages_array = array('toplevel_page_alecaddd_sunset', 'sunset_page_alecaddd_sunset_theme', 'sunset_page_alecaddd_sunset_theme_contact');
if (in_array($hook, $pages_array)) {
wp_enqueue_style('raleway-admin');
wp_enqueue_style('sunset_admin');
} else {
if ('toplevel_page_alecaddd_sunset' == $hook) {
wp_enqueue_media();
wp_enqueue_script('sunset-admin-script');
} else {
if ('sunset_page_alecaddd_sunset_css' == $hook) {
wp_enqueue_style('raleway-admin');
wp_enqueue_style('sunset_admin');
wp_enqueue_style('ace', get_template_directory_uri() . '/css/sunset.ace.css', array(), '1.0.0', 'all');
wp_enqueue_script('ace', get_template_directory_uri() . '/js/ace/ace.js', array('jquery'), '1.2.1', true);
wp_enqueue_script('sunset-custom-css-script', get_template_directory_uri() . '/js/sunset.custom_css.js', array('jquery'), '1.0.0', true);
} else {
return;
}
}
}
}
示例7: enqueue_media
public function enqueue_media()
{
if (!$this->is_active()) {
return;
}
wp_enqueue_media();
}
示例8: admin_enqueue_scripts
/**
* Queue assets for taxonomy screens.
*
* @since 1.5.0
*/
public function admin_enqueue_scripts()
{
$pagenow = $GLOBALS['pagenow'];
if (!(self::is_term_edit($pagenow) || self::is_term_overview($pagenow))) {
return;
}
$asset_manager = new WPSEO_Admin_Asset_Manager();
$asset_manager->enqueue_style('scoring');
$tag_id = filter_input(INPUT_GET, 'tag_ID');
if (self::is_term_edit($pagenow) && !empty($tag_id)) {
wp_enqueue_media();
// Enqueue files needed for upload functionality.
$asset_manager->enqueue_style('metabox-css');
$asset_manager->enqueue_style('snippet');
$asset_manager->enqueue_style('scoring');
wp_editor('', 'description');
$asset_manager->enqueue_script('metabox');
$asset_manager->enqueue_script('term-scraper');
wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'term-scraper', 'wpseoTermScraperL10n', $this->localize_term_scraper_script());
wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'replacevar-plugin', 'wpseoReplaceVarsL10n', $this->localize_replace_vars_script());
wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'metabox', 'wpseoSelect2Locale', substr(get_locale(), 0, 2));
$asset_manager->enqueue_script('admin-media');
wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'admin-media', 'wpseoMediaL10n', array('choose_image' => __('Use Image', 'wordpress-seo')));
}
}
示例9: accesspress_lite_admin_scripts
function accesspress_lite_admin_scripts()
{
wp_enqueue_media();
wp_enqueue_script('accesspresslite_custom_js', get_template_directory_uri() . '/inc/admin-panel/js/custom.js', array('jquery'));
wp_enqueue_script('of-media-uploader', get_template_directory_uri() . '/inc/admin-panel/js/media-uploader.js', array('jquery'));
wp_enqueue_style('accesspresslite_admin_style', get_template_directory_uri() . '/inc/admin-panel/css/admin.css', '1.0', 'screen');
}
示例10: admin_enqueue_scripts
/**
* Enqueue scripts and styles
*
* @return void
*/
static function admin_enqueue_scripts()
{
wp_enqueue_media();
wp_enqueue_style('mashsb-rwmb-media', MASHSB_RWMB_CSS_URL . 'media.css', array(), MASHSB_RWMB_VER);
wp_enqueue_script('mashsb-rwmb-media', MASHSB_RWMB_JS_URL . 'media.js', array('jquery-ui-sortable', 'underscore', 'backbone'), MASHSB_RWMB_VER, true);
wp_localize_script('mashsb-rwmb-media', 'i18nRwmbMedia', array('add' => apply_filters('rwmb_media_add_string', _x('Add Image', 'media', 'meta-box')), 'single' => apply_filters('rwmb_media_single_files_string', _x(' file', 'media', 'meta-box')), 'multiple' => apply_filters('rwmb_media_multiple_files_string', _x(' files', 'media', 'meta-box')), 'remove' => apply_filters('rwmb_media_remove_string', _x('Remove', 'media', 'meta-box')), 'edit' => apply_filters('rwmb_media_edit_string', _x('Edit', 'media', 'meta-box')), 'view' => apply_filters('rwmb_media_view_string', _x('View', 'media', 'meta-box')), 'noTitle' => _x('No Title', 'media', 'meta-box'), 'loadingUrl' => MASHSB_RWMB_URL . 'img/loader.gif', 'extensions' => self::get_mime_extensions(), 'select' => _x('Select Files', 'media', 'meta-box'), 'uploadInstructions' => _x('Drop files here to upload', 'media', 'meta-box')));
}
示例11: __construct
public function __construct()
{
add_action('admin_enqueue_scripts', function () {
if (did_action('wp_enqueue_media') == false) {
wp_enqueue_media();
}
wp_add_inline_script('image-edit', '
jQuery(".plance-medial-button-select").live("click",function()
{
var send_attachment_bkp = wp.media.editor.send.attachment;
var $btn = jQuery(this);
wp.media.editor.send.attachment = function(props, attachment)
{
jQuery($btn).parents(".plance-medial").find(".plance-medial-img").attr("src", attachment.url);
jQuery($btn).parents(".plance-medial").find(".plance-medial-src").val(attachment.url);
wp.media.editor.send.attachment = send_attachment_bkp;
}
wp.media.editor.open($btn);
return false;
});
jQuery(".plance-medial-button-remove").live("click",function()
{
var $p = jQuery(this).parents(".plance-medial");
var src = $p.find(".plance-medial-img").attr("data-src");
$p.find(".plance-medial-img").attr("src", src);
$p.find(".plance-medial-src").val("");
return false;
});
');
});
}
示例12: admin_setup
function admin_setup()
{
wp_enqueue_media();
wp_register_script('tpw-admin-js', plugins_url('tpw_admin.js', __FILE__), array('jquery', 'media-upload', 'media-views'));
wp_enqueue_script('tpw-admin-js');
wp_enqueue_style('tpw-admin', plugins_url('tpw_admin.css', __FILE__));
}
示例13: fg_enqueue_stuff
function fg_enqueue_stuff()
{
wp_enqueue_media();
wp_enqueue_script('fg-admin-script', plugin_dir_url(dirname(__FILE__)) . 'js/admin.js');
wp_localize_script('fg-admin-script', 'myAjax', array('ajaxurl' => admin_url('admin-ajax.php')));
wp_enqueue_style('fg-admin-style', plugin_dir_url(dirname(__FILE__)) . 'css/admin.css');
}
示例14: theme_widgets_admin_scripts
function theme_widgets_admin_scripts()
{
wp_enqueue_media();
wp_enqueue_style('theme-widgets-style', ELUSICVE_THEME_URI . '/includes/widgets/scripts/theme-widgets-style.css');
wp_enqueue_script('theme-widgets-js', ELUSICVE_THEME_URI . '/includes/widgets/scripts/theme-widgets-js.js', array('jquery', 'media-upload'), '1.0', true);
wp_localize_script('theme-widgets-js', 'theme_widgets_settings', array('ajax_url' => admin_url('admin-ajax.php'), 'action' => 'theme_widgets_stttings'));
}
示例15: addCommonScripts
/**
*
* add common used scripts
*/
public static function addCommonScripts()
{
//include jquery ui
if (GlobalsRevSlider::$isNewVersion) {
//load new jquery ui library
$urlJqueryUI = "https://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js";
self::addScriptAbsoluteUrl($urlJqueryUI, "jquery-ui");
self::addStyle("jquery-ui-1.9.2.custom.min", "jui-smoothness", "css/jui/new");
if (function_exists("wp_enqueue_media")) {
wp_enqueue_media();
}
} else {
//load old jquery ui library
$urlJqueryUI = "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js";
self::addScriptAbsoluteUrl($urlJqueryUI, "jquery-ui");
self::addStyle("jquery-ui-1.8.18.custom", "jui-smoothness", "css/jui/old");
}
self::addScriptCommon("settings", "unite_settings");
self::addScriptCommon("admin", "unite_admin");
self::addScriptCommon("jquery.tipsy", "tipsy");
//--- add styles
self::addStyleCommon("admin", "unite_admin");
//add tipsy
self::addStyleCommon("tipsy", "tipsy");
//include farbtastic
self::addScriptCommon("my-farbtastic", "my-farbtastic", "js/farbtastic");
self::addStyleCommon("farbtastic", "farbtastic", "js/farbtastic");
//include codemirror
self::addScriptCommon("codemirror", "codemirror_js", "js/codemirror");
self::addScriptCommon("css", "codemirror_js_css", "js/codemirror");
self::addStyleCommon("codemirror", "codemirror_css", "js/codemirror");
}