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

PHP WP_Customize_Control类代码示例

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

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



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

示例1: _build_controls

 protected function _build_controls()
 {
     $this->_add_control('_header', ['description' => $this->description, 'label' => $this->label], 'Header');
     $this->manager->add_setting("{$this->id}[post_id]", ['type' => 'option', 'transport' => 'postMessage']);
     add_action("customize_save_{$this->_panel}", function ($setting) {
         if ($setting->id == "{$this->id}[post_id]") {
             $this->_save_post_id($setting);
         }
     });
     $control = new \WP_Customize_Control($this->manager, "{$this->id}[post_id]", ['type' => 'hidden', 'section' => $this->section, 'input_attrs' => ['style' => 'width: 100%;', 'data-post_type' => isset($this->post_type) ? $this->post_type : 'post', 'data-placeholder' => __('— Select —')]]);
     $control->input_attrs['data-value'] = get_the_title($control->value());
     $this->manager->add_control($control);
 }
开发者ID:Viktor777,项目名称:wp-customize-builder,代码行数:13,代码来源:Post.php


示例2: to_json

 /**
  * Refresh the parameters passed to the JavaScript via JSON.
  *
  * @since 3.4.0
  * @uses WP_Customize_Control::to_json()
  */
 public function to_json()
 {
     parent::to_json();
     $this->json['statuses'] = $this->statuses;
     $this->json['defaultValue'] = $this->setting->default;
     $this->json['mode'] = $this->mode;
 }
开发者ID:johnpbloch,项目名称:wordpress,代码行数:13,代码来源:class-wp-customize-color-control.php


示例3: to_json

 /**
  * Refresh the parameters passed to the JavaScript via JSON.
  *
  * @since 3.4.0
  * @since 4.2.0 Moved from WP_Customize_Upload_Control.
  *
  * @see WP_Customize_Control::to_json()
  */
 public function to_json()
 {
     parent::to_json();
     $this->json['label'] = html_entity_decode($this->label, ENT_QUOTES, get_bloginfo('charset'));
     $this->json['mime_type'] = $this->mime_type;
     $this->json['button_labels'] = $this->button_labels;
     $this->json['canUpload'] = current_user_can('upload_files');
     $value = $this->value();
     if (is_object($this->setting)) {
         if ($this->setting->default) {
             // Fake an attachment model - needs all fields used by template.
             // Note that the default value must be a URL, NOT an attachment ID.
             $type = in_array(substr($this->setting->default, -3), array('jpg', 'png', 'gif', 'bmp')) ? 'image' : 'document';
             $default_attachment = array('id' => 1, 'url' => $this->setting->default, 'type' => $type, 'icon' => wp_mime_type_icon($type), 'title' => basename($this->setting->default));
             if ('image' === $type) {
                 $default_attachment['sizes'] = array('full' => array('url' => $this->setting->default));
             }
             $this->json['defaultAttachment'] = $default_attachment;
         }
         if ($value && $this->setting->default && $value === $this->setting->default) {
             // Set the default as the attachment.
             $this->json['attachment'] = $this->json['defaultAttachment'];
         } elseif ($value) {
             $this->json['attachment'] = wp_prepare_attachment_for_js($value);
         }
     }
 }
开发者ID:itspriddle,项目名称:wordpress-playground,代码行数:35,代码来源:class-wp-customize-media-control.php


示例4: to_json

 /**
  * Refresh the parameters passed to the JavaScript via JSON.
  *
  * @since 3.1.0
  * @uses WP_Customize_Control::to_json()
  */
 public function to_json()
 {
     parent::to_json();
     $this->json['posts'] = $this->get_posts();
     $this->json['postTypes'] = $this->post_types;
     $this->json['l10n'] = array('responseError' => __('An error has occurred. Please reload the page and try again.', 'huesos'));
 }
开发者ID:TyRichards,项目名称:ty_the_band,代码行数:13,代码来源:class-cedaro-theme-customize-control-featuredcontent.php


示例5: __construct

 /**
  * Constructor.
  *
  * @since 3.4.0
  * @uses WP_Customize_Control::__construct()
  *
  * @param WP_Customize_Manager $manager
  * @param string $id
  * @param array $args
  */
 public function __construct($manager, $id, $args = array())
 {
     parent::__construct($manager, $id, $args);
     if (!empty($args['choices'])) {
         $this->colours = $args['choices'];
     }
 }
开发者ID:LinaPeterssonOberg,项目名称:exam,代码行数:17,代码来源:customizer-colour.php


示例6: test_check_capabilities

 /**
  * Test WP_Customize_Control::check_capabilities().
  *
  * @see WP_Customize_Control::check_capabilities()
  */
 function test_check_capabilities()
 {
     do_action('customize_register', $this->wp_customize);
     $control = new WP_Customize_Control($this->wp_customize, 'blogname', array('settings' => array('blogname')));
     $this->assertTrue($control->check_capabilities());
     $control = new WP_Customize_Control($this->wp_customize, 'blogname', array('settings' => array('blogname', 'non_existing')));
     $this->assertFalse($control->check_capabilities());
     $this->wp_customize->add_setting('top_secret_message', array('capability' => 'top_secret_clearance'));
     $control = new WP_Customize_Control($this->wp_customize, 'blogname', array('settings' => array('blogname', 'top_secret_clearance')));
     $this->assertFalse($control->check_capabilities());
     $control = new WP_Customize_Control($this->wp_customize, 'no_setting', array('settings' => array()));
     $this->assertTrue($control->check_capabilities());
     $control = new WP_Customize_Control($this->wp_customize, 'no_setting', array('settings' => array(), 'capability' => 'top_secret_clearance'));
     $this->assertFalse($control->check_capabilities());
     $control = new WP_Customize_Control($this->wp_customize, 'no_setting', array('settings' => array(), 'capability' => 'edit_theme_options'));
     $this->assertTrue($control->check_capabilities());
 }
开发者ID:aaemnnosttv,项目名称:develop.git.wordpress.org,代码行数:22,代码来源:control.php


示例7: test_check_capabilities

 /**
  * Test WP_Customize_Control::check_capabilities().
  *
  * @see WP_Customize_Control::check_capabilities()
  */
 function test_check_capabilities()
 {
     wp_set_current_user(self::factory()->user->create(array('role' => 'administrator')));
     do_action('customize_register', $this->wp_customize);
     $control = new WP_Customize_Control($this->wp_customize, 'blogname', array('settings' => array('blogname')));
     $this->assertTrue($control->check_capabilities());
     $control = new WP_Customize_Control($this->wp_customize, 'blogname', array('settings' => array('blogname', 'non_existing')));
     $this->assertFalse($control->check_capabilities());
     $this->wp_customize->add_setting('top_secret_message', array('capability' => 'top_secret_clearance'));
     $control = new WP_Customize_Control($this->wp_customize, 'blogname', array('settings' => array('blogname', 'top_secret_clearance')));
     $this->assertFalse($control->check_capabilities());
     $control = new WP_Customize_Control($this->wp_customize, 'no_setting', array('settings' => array()));
     $this->assertTrue($control->check_capabilities());
     $control = new WP_Customize_Control($this->wp_customize, 'no_setting', array('settings' => array(), 'capability' => 'top_secret_clearance'));
     $this->assertFalse($control->check_capabilities());
     $control = new WP_Customize_Control($this->wp_customize, 'no_setting', array('settings' => array(), 'capability' => 'edit_theme_options'));
     $this->assertTrue($control->check_capabilities());
 }
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:23,代码来源:control.php


示例8: to_json

 /**
  * Refresh the parameters passed to the JavaScript via JSON.
  *
  * @see WP_Customize_Media_Control::to_json()
  * @since 0.1
  */
 public function to_json()
 {
     parent::to_json();
     $clc = CLC_Content_Layout_Control();
     $this->json['components'] = array_intersect($this->components, array_keys($clc->components));
     $this->json['i18n'] = $this->i18n;
 }
开发者ID:NateWr,项目名称:content-layout-control,代码行数:13,代码来源:CLC_WP_Customize_Content_Layout_Control.php


示例9: enqueue

 /**
  * This function enqueues scripts and styles
  */
 public function enqueue()
 {
     wp_enqueue_script('sds-theme-options-customizer-color-scheme', SDS_Theme_Options::sds_core_url() . '/js/customizer-sds-theme-options-color-scheme.js', array('customize-base', 'customize-controls'), SDS_Theme_Options::get_version());
     wp_localize_script('sds-theme-options-customizer-color-scheme', 'sds_color_schemes_customizer', array('color_schemes' => sds_color_schemes(), 'controls' => $this->color_controls));
     // Call the parent enqueue method here
     parent::enqueue();
 }
开发者ID:sdsweb,项目名称:baton,代码行数:10,代码来源:class-sds-theme-options-customize-color-scheme-control.php


示例10: __construct

 public function __construct($manager, $id, $args = array())
 {
     if (isset($args['taxonomy']) && in_array($args['taxonomy'], get_taxonomies())) {
         $this->taxonomy = $args['taxonomy'];
     }
     parent::__construct($manager, $id, $args);
 }
开发者ID:datalynk,项目名称:quizzlestick,代码行数:7,代码来源:icit-custom-controls.php


示例11: __construct

 public function __construct($manager, $id, $args = array())
 {
     parent::__construct($manager, $id, $args);
     if ($this->font_set_filter) {
         $this->font_set = apply_filters($this->font_set_filter, $this->font_set, $this->id);
     }
 }
开发者ID:j-kenneth,项目名称:Expeero,代码行数:7,代码来源:TdCustomizeFontControl.php


示例12: to_json

 public function to_json()
 {
     parent::to_json();
     $this->json['value'] = $this->value();
     $this->json['choices'] = $this->choices;
     $this->json['link'] = $this->get_link();
 }
开发者ID:Wordpress-Development,项目名称:ornea,代码行数:7,代码来源:class-kirki-controls-number-control.php


示例13: __construct

 /**
  * Constructor for our custom control.
  *
  * @param object $wp_customize
  * @param string $control_id
  * @param array $args
  * @uses Site_Logo_Image_Control::l10n()
  */
 public function __construct($wp_customize, $control_id, $args = array())
 {
     // declare these first so they can be overridden
     $this->l10n = array('upload' => __('Add logo', 'layerswp'), 'set' => __('Set as logo', 'layerswp'), 'choose' => __('Choose logo', 'layerswp'), 'change' => __('Change logo', 'layerswp'), 'remove' => __('Remove logo', 'layerswp'), 'placeholder' => __('No logo set', 'layerswp'));
     $this->directory_uri = LAYERS_TEMPLATE_URI . '/core/third-party/site-logo/';
     parent::__construct($wp_customize, $control_id, $args);
 }
开发者ID:angelabier1,项目名称:layerswp,代码行数:15,代码来源:class-site-logo-control.php


示例14: __construct

 public function __construct($manager, $id, $args = array())
 {
     parent::__construct($manager, $id, $args);
     if (!empty($args['llorix_one_lite_message'])) {
         $this->message = $args['llorix_one_lite_message'];
     }
 }
开发者ID:jenia-buianov,项目名称:all_my_sites,代码行数:7,代码来源:customizer.php


示例15: __construct

 public function __construct($manager, $id, $args = array())
 {
     $_opt_prefix = TC_wfc::$instance->plug_option_prefix;
     $this->customs = get_option("{$_opt_prefix}_customs_" . TC_wfc::$theme_name);
     $this->lang_domain = TC_wfc::$instance->plug_lang;
     $this->selector_settings = TC_wfc::$instance->tc_get_selector_list();
     parent::__construct($manager, $id, $args);
 }
开发者ID:umairriaz90,项目名称:Daschug1,代码行数:8,代码来源:class_customizer_font_controls.php


示例16: to_json

 /**
  * Add custom parameters to pass to the JS via JSON.
  *
  * @since  3.0.0
  * @access public
  * @return void
  */
 public function to_json()
 {
     parent::to_json();
     $this->json['value'] = !is_array($this->value()) ? explode(',', $this->value()) : $this->value();
     $this->json['choices'] = $this->choices;
     $this->json['link'] = $this->get_link();
     $this->json['id'] = $this->id;
 }
开发者ID:lagrezd,项目名称:dx-coding-standards,代码行数:15,代码来源:control-checkbox-multiple.php


示例17: to_json

 public function to_json()
 {
     parent::to_json();
     $exported_properties = array('widget_id', 'widget_id_base', 'sidebar_id', 'width', 'height', 'is_wide', 'is_live_previewable');
     foreach ($exported_properties as $key) {
         $this->json[$key] = $this->{$key};
     }
 }
开发者ID:niceit,项目名称:rockets,代码行数:8,代码来源:class-widget-form-wp-customize-control.php


示例18: enqueue

 public function enqueue()
 {
     parent::enqueue();
     $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
     wp_enqueue_style('switchery', get_template_directory_uri() . "/lib/framework/customizer/controls/assets/plugins/switchery/switchery{$suffix}.css", array(), '0.7.0', 'screen');
     wp_enqueue_script('switchery', get_template_directory_uri() . "/lib/framework/customizer/controls/assets/plugins/switchery/switchery{$suffix}.js", array(), '0.7.0', true);
     wp_enqueue_script('youxi-switch-control', get_template_directory_uri() . "/lib/framework/customizer/controls/assets/js/switch-control.js", array('switchery'), YOUXI_CUSTOMIZER_VERSION, true);
 }
开发者ID:yemingyuen,项目名称:mingsg,代码行数:8,代码来源:class-switch-control.php


示例19: __construct

 public function __construct($manager, $id, $args = array())
 {
     parent::__construct($manager, $id, $args);
     if (empty($args['psu_args']) || !is_array($args['psu_args'])) {
         $args['psu_args'] = array();
     }
     $this->psu_args = $args['psu_args'];
 }
开发者ID:voceconnect,项目名称:voce-theme-customizer,代码行数:8,代码来源:Voce_Customize_PSU_Control.php


示例20: enqueue

 public function enqueue()
 {
     wp_register_style('zerowp-customizer-ui-slider-styles', plugin_dir_url(__FILE__) . 'assets/styles.css');
     wp_enqueue_style('zerowp-customizer-ui-slider-styles');
     wp_register_script('zerowp-customizer-ui-slider-scripts', plugin_dir_url(__FILE__) . 'assets/scripts.js', array('jquery', 'jquery-ui-core'), false, true);
     wp_enqueue_script('zerowp-customizer-ui-slider-scripts');
     parent::enqueue();
 }
开发者ID:ZeroWP,项目名称:Customizer,代码行数:8,代码来源:control.class.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP WP_Customize_Image_Control类代码示例发布时间:2022-05-23
下一篇:
PHP WP_Comment_Query类代码示例发布时间: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