/**
  * Color picker
  *
  * @param string $control_id
  * @param array $args argments of add_setting and add_control
  */
 public function color($control_id, $args)
 {
     $args = $this->init_field_args($control_id, $args);
     $args = $this->set_default_sanitize_callback($args, 'sanitize_hex_color');
     $this->Customizer->add_setting($control_id, $args);
     $this->Customizer->add_control(new WP_Customize_Color_Control($this->Customizer, $control_id, array_merge($args, array('settings' => $control_id))));
 }
示例#2
0
 /**
  * テーマカスタマイザーにオリジナル項目を設定
  *
  * @param WP_Customizer $wp_customize
  */
 public function customize_register($wp_customize)
 {
     $wp_customize->add_section('habakiri_design', array('title' => __('settings', 'habakiri'), 'priority' => 100));
     $wp_customize->add_setting('logo', array('default' => self::get_default('logo'), 'sanitize_callback' => array($this, 'sanitize_image_url')));
     $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'logo', array('label' => __('Logo', 'habakiri'), 'section' => 'habakiri_design', 'settings' => 'logo')));
     $wp_customize->add_setting('logo_text_color', array('default' => self::get_default('logo_text_color'), 'sanitize_callback' => array($this, 'sanitize_colorcode')));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'logo_text_color', array('label' => __('Logo Text Color', 'habakiri'), 'section' => 'colors', 'settings' => 'logo_text_color')));
     $wp_customize->add_setting('header', array('default' => self::get_default('header'), 'sanitize_callback' => array($this, 'sanitize_header')));
     $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'header', array('label' => __('Header', 'habakiri'), 'section' => 'habakiri_design', 'settings' => 'header', 'type' => 'radio', 'choices' => $this->header_choices)));
     $wp_customize->add_setting('header_fixed', array('default' => self::get_default('header_fixed'), 'sanitize_callback' => array($this, 'sanitize_header_fixed')));
     $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'header_fixed', array('label' => __('Header Fixed', 'habakiri'), 'section' => 'habakiri_design', 'settings' => 'header_fixed', 'type' => 'radio', 'choices' => $this->header_fixed_choices)));
     $wp_customize->add_setting('footer_columns', array('default' => self::get_default('footer_columns'), 'sanitize_callback' => array($this, 'sanitize_footer_columns')));
     $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'footer_columns', array('label' => __('Number of footer columns', 'habakiri'), 'section' => 'habakiri_design', 'settings' => 'footer_columns', 'type' => 'radio', 'choices' => $this->footer_columns_choices)));
     $wp_customize->add_setting('blog_template', array('default' => self::get_default('blog_template'), 'sanitize_callback' => array($this, 'sanitize_blog_template')));
     $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'blog_template', array('label' => __('Blog Template', 'habakiri'), 'section' => 'habakiri_design', 'settings' => 'blog_template', 'type' => 'radio', 'choices' => $this->blog_template_choices)));
     $wp_customize->add_setting('search_template', array('default' => self::get_default('search_template'), 'sanitize_callback' => array($this, 'sanitize_search_template')));
     $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'search_template', array('label' => __('Search Template', 'habakiri'), 'section' => 'habakiri_design', 'settings' => 'search_template', 'type' => 'radio', 'choices' => $this->search_template_choices)));
     $wp_customize->add_setting('404_template', array('default' => self::get_default('404_template'), 'sanitize_callback' => array($this, 'sanitize_404_template')));
     $wp_customize->add_control(new WP_Customize_Control($wp_customize, '404_template', array('label' => __('404 Template', 'habakiri'), 'section' => 'habakiri_design', 'settings' => '404_template', 'type' => 'radio', 'choices' => $this->_404_template_choices)));
     $wp_customize->add_setting('is_displaying_thumbnail', array('default' => self::get_default('is_displaying_thumbnail'), 'sanitize_callback' => array($this, 'sanitize_is_displaying_thumbnail')));
     $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'is_displaying_thumbnail', array('label' => __('Displaying thumbnail in archive page', 'habakiri'), 'section' => 'habakiri_design', 'settings' => 'is_displaying_thumbnail', 'type' => 'radio', 'choices' => $this->boolean_choices)));
     $wp_customize->add_setting('is_displaying_bread_crumb', array('default' => self::get_default('is_displaying_bread_crumb'), 'sanitize_callback' => array($this, 'sanitize_is_displaying_bread_crumb')));
     $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'is_displaying_bread_crumb', array('label' => __('Displaying the Bread Crumb', 'habakiri'), 'section' => 'habakiri_design', 'settings' => 'is_displaying_bread_crumb', 'type' => 'radio', 'choices' => $this->boolean_choices)));
     $wp_customize->add_setting('is_displaying_related_posts', array('default' => self::get_default('is_displaying_related_posts'), 'sanitize_callback' => array($this, 'sanitize_is_displaying_related_posts')));
     $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'is_displaying_related_posts', array('label' => __('Displaying related posts in single page', 'habakiri'), 'section' => 'habakiri_design', 'settings' => 'is_displaying_related_posts', 'type' => 'radio', 'choices' => $this->boolean_choices)));
     $wp_customize->add_setting('is_displaying_page_header', array('default' => self::get_default('is_displaying_page_header'), 'sanitize_callback' => array($this, 'sanitize_is_displaying_page_header')));
     $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'is_displaying_page_header', array('label' => __('Displaying page header', 'habakiri'), 'section' => 'habakiri_design', 'settings' => 'is_displaying_page_header', 'type' => 'radio', 'choices' => $this->boolean_choices)));
     $wp_customize->add_setting('is_displaying_page_header_lead', array('default' => self::get_default('is_displaying_page_header_lead'), 'sanitize_callback' => array($this, 'sanitize_is_displaying_page_header_lead')));
     $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'is_displaying_page_header_lead', array('label' => __('Displaying lead of page header in single page', 'habakiri'), 'section' => 'habakiri_design', 'settings' => 'is_displaying_page_header_lead', 'type' => 'radio', 'choices' => $this->boolean_choices)));
     $wp_customize->add_setting('link_color', array('default' => self::get_default('link_color'), 'sanitize_callback' => array($this, 'sanitize_colorcode')));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'link_color', array('label' => __('Link Color', 'habakiri'), 'section' => 'colors', 'settings' => 'link_color')));
     $wp_customize->add_setting('link_hover_color', array('default' => self::get_default('link_hover_color'), 'sanitize_callback' => array($this, 'sanitize_colorcode')));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'link_hover_color', array('label' => __('Link Hover Color', 'habakiri'), 'section' => 'colors', 'settings' => 'link_hover_color')));
     $wp_customize->add_setting('gnav_link_color', array('default' => self::get_default('gnav_link_color'), 'sanitize_callback' => array($this, 'sanitize_colorcode')));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'gnav_link_color', array('label' => __('Global Navigation Link Color', 'habakiri'), 'section' => 'colors', 'settings' => 'gnav_link_color')));
     $wp_customize->add_setting('gnav_link_hover_color', array('default' => self::get_default('gnav_link_hover_color'), 'sanitize_callback' => array($this, 'sanitize_colorcode')));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'gnav_link_hover_color', array('label' => __('Global Navigation Link Hover Color', 'habakiri'), 'section' => 'colors', 'settings' => 'gnav_link_hover_color')));
     $wp_customize->add_setting('gnav_pulldown_link_color', array('default' => self::get_default('gnav_pulldown_link_color'), 'sanitize_callback' => array($this, 'sanitize_colorcode')));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'gnav_pulldown_link_color', array('label' => __('Global Navigation Pulldown Link Color', 'habakiri'), 'section' => 'colors', 'settings' => 'gnav_pulldown_link_color')));
     $wp_customize->add_setting('gnav_pulldown_bg_color', array('default' => self::get_default('gnav_pulldown_bg_color'), 'sanitize_callback' => array($this, 'sanitize_colorcode')));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'gnav_pulldown_bg_color', array('label' => __('Global Navigation Pulldown Background Color', 'habakiri'), 'section' => 'colors', 'settings' => 'gnav_pulldown_bg_color')));
     $wp_customize->add_setting('gnav_pulldown_bg_hover_color', array('default' => self::get_default('gnav_pulldown_bg_hover_color'), 'sanitize_callback' => array($this, 'sanitize_colorcode')));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'gnav_pulldown_bg_hover_color', array('label' => __('Global Navigation Pulldown Background Hover Color', 'habakiri'), 'section' => 'colors', 'settings' => 'gnav_pulldown_bg_hover_color')));
     $wp_customize->add_setting('header_bg_color', array('default' => self::get_default('header_bg_color'), 'sanitize_callback' => array($this, 'sanitize_colorcode')));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'header_bg_color', array('label' => __('Header Background Color', 'habakiri'), 'section' => 'colors', 'settings' => 'header_bg_color')));
     $wp_customize->add_setting('footer_bg_color', array('default' => self::get_default('footer_bg_color'), 'sanitize_callback' => array($this, 'sanitize_colorcode')));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'footer_bg_color', array('label' => __('Footer Background Color', 'habakiri'), 'section' => 'colors', 'settings' => 'footer_bg_color')));
     $wp_customize->add_setting('footer_text_color', array('default' => self::get_default('footer_text_color'), 'sanitize_callback' => array($this, 'sanitize_colorcode')));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'footer_text_color', array('label' => __('Footer Text Color', 'habakiri'), 'section' => 'colors', 'settings' => 'footer_text_color')));
     $wp_customize->add_setting('footer_link_color', array('default' => self::get_default('footer_link_color'), 'sanitize_callback' => array($this, 'sanitize_colorcode')));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'footer_link_color', array('label' => __('Footer Link Color', 'habakiri'), 'section' => 'colors', 'settings' => 'footer_link_color')));
     $wp_customize->add_setting('page_header_bg_color', array('default' => self::get_default('page_header_bg_color'), 'sanitize_callback' => array($this, 'sanitize_colorcode')));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'page_header_bg_color', array('label' => __('Page Header Background Color', 'habakiri'), 'section' => 'colors', 'settings' => 'page_header_bg_color')));
     $wp_customize->add_setting('page_header_text_color', array('default' => self::get_default('page_header_text_color'), 'sanitize_callback' => array($this, 'sanitize_colorcode')));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'page_header_text_color', array('label' => __('Page Header Text Color', 'habakiri'), 'section' => 'colors', 'settings' => 'page_header_text_color')));
 }
示例#3
0
 /**
  * customize_register
  * @param WP_Customizer $wp_customize
  */
 public function customize_register($wp_customize)
 {
     $wp_customize->get_setting('blogname')->transport = 'postMessage';
     $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
     $wp_customize->add_section('kotetsu_design', array('title' => __('settings', 'kotetsu'), 'priority' => 100));
     require_once get_template_directory() . '/inc/kotetsu-logo-control.php';
     $wp_customize->add_setting('logo', array('default' => $this->defaults['logo'], 'sanitize_callback' => array($this, 'sanitize_image_url')));
     $wp_customize->add_control(new Kotetsu_Logo_Control($wp_customize, 'logo', array('label' => __('Logo', 'kotetsu'), 'section' => 'kotetsu_design', 'settings' => 'logo')));
     $wp_customize->add_setting('gnav_color', array('default' => $this->defaults['gnav_color'], 'transport' => 'postMessage', 'sanitize_callback' => array($this, 'sanitize_colorcode')));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'gnav_color', array('label' => __('Global navigation color', 'kotetsu'), 'section' => 'colors', 'settings' => 'gnav_color')));
     $wp_customize->add_setting('gnav_rollover_color', array('default' => $this->defaults['gnav_rollover_color'], 'sanitize_callback' => array($this, 'sanitize_colorcode')));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'gnav_rollover_color', array('label' => __('Global navigation rollover color', 'kotetsu'), 'section' => 'colors', 'settings' => 'gnav_rollover_color')));
     $wp_customize->add_setting('font_color', array('default' => $this->defaults['font_color'], 'transport' => 'postMessage', 'sanitize_callback' => array($this, 'sanitize_colorcode')));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'font_color', array('label' => __('Font color', 'kotetsu'), 'section' => 'colors', 'settings' => 'font_color')));
     $wp_customize->add_setting('link_color', array('default' => $this->defaults['link_color'], 'transport' => 'postMessage', 'sanitize_callback' => array($this, 'sanitize_colorcode')));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'link_color', array('label' => __('Link color', 'kotetsu'), 'section' => 'colors', 'settings' => 'link_color')));
 }