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


PHP WP_Customize_Control类代码示例

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


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

示例8: 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

示例9: __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

示例10: __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

示例11: 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

示例12: __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

示例13: __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

示例14: __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

示例15: 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


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