/**
  * Configure settings and controls for the Site Title & Tagline section.
  *
  * @since  1.0.0.
  *
  * @return void
  */
 function ttfmake_customizer_sitetitletagline()
 {
     global $wp_customize;
     $theme_prefix = 'ttfmake_';
     $section_id = 'title_tagline';
     $section = $wp_customize->get_section($section_id);
     $priority = new TTFMAKE_Prioritizer(10, 5);
     // Move Site Title & Tagline section to General panel
     $section->panel = $theme_prefix . 'general';
     // Set Site Title & Tagline section priority
     $logo_priority = $wp_customize->get_section($theme_prefix . 'logo')->priority;
     $section->priority = $logo_priority - 5;
     // Reset priorities on Site Title control
     $wp_customize->get_control('blogname')->priority = $priority->add();
     // Hide Site Title option
     $options = array('hide-site-title' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Hide Site Title', 'make'), 'type' => 'checkbox')));
     $new_priority = ttfmake_customizer_add_section_options($section_id, $options, $priority->add());
     $priority->set($new_priority);
     // Reset priorities on Tagline control
     $wp_customize->get_control('blogdescription')->priority = $priority->add();
     // Hide Tagline option
     $options = array('hide-tagline' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Hide Tagline', 'make'), 'type' => 'checkbox')));
     $new_priority = ttfmake_customizer_add_section_options($section_id, $options, $priority->add());
     $priority->set($new_priority);
 }
Esempio n. 2
0
 /**
  * Configure settings and controls for the Background section.
  *
  * @since  1.0.0.
  *
  * @return void
  */
 function ttfmake_customizer_background()
 {
     global $wp_customize;
     $theme_prefix = 'ttfmake_';
     $section_id = 'background_image';
     $section = $wp_customize->get_section($section_id);
     $priority = new TTFMAKE_Prioritizer(10, 5);
     // Bail if the section isn't registered
     if (!is_object($section) || 'WP_Customize_Section' !== get_class($section)) {
         return;
     }
     // Move and rename Background Color control to Global section of Color panel
     $wp_customize->get_control('background_color')->section = $theme_prefix . 'color';
     $wp_customize->get_control('background_color')->label = __('Site Background Color', 'make');
     $wp_customize->get_control('background_color')->priority = (int) $wp_customize->get_control($theme_prefix . 'color-group-global-background')->priority + 5;
     // Move Background Image section to Background Images panel
     $section->panel = $theme_prefix . 'background-images';
     // Set section title
     $section->title = __('Site', 'make');
     // Set section priority
     $header_priority = $wp_customize->get_section($theme_prefix . 'header-background')->priority;
     $section->priority = $header_priority - 5;
     // Reconfigure image and repeat controls
     $wp_customize->get_control('background_image')->label = __('Background Image', 'make');
     $wp_customize->get_control('background_image')->priority = $priority->add();
     $wp_customize->get_control('background_repeat')->label = __('Repeat', 'make');
     $wp_customize->get_control('background_repeat')->priority = $priority->add();
     // Remove position and attachment controls
     $wp_customize->remove_control('background_position_x');
     $wp_customize->remove_control('background_attachment');
     // Add replacement and new controls
     $options = array('background_position_x' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('control_type' => 'TTFMAKE_Customize_Background_Position_Control', 'label' => __('Position', 'make'), 'type' => 'radio', 'choices' => ttfmake_get_choices('background_position_x'))), 'background_attachment' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('control_type' => 'TTFMAKE_Customize_Radio_Control', 'label' => __('Attachment', 'make'), 'type' => 'radio', 'mode' => 'buttonset', 'choices' => ttfmake_get_choices('background_attachment'))), 'background_size' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('control_type' => 'TTFMAKE_Customize_Radio_Control', 'label' => __('Size', 'make'), 'type' => 'radio', 'mode' => 'buttonset', 'choices' => ttfmake_get_choices('background_size'))));
     $new_priority = ttfmake_customizer_add_section_options($section_id, $options, $priority->add());
     $priority->set($new_priority);
 }
Esempio n. 3
0
 /**
  * Configure settings and controls for the Background section.
  *
  * @since  1.0.0.
  *
  * @return void
  */
 function ttfmake_customizer_background()
 {
     global $wp_customize;
     $theme_prefix = 'ttfmake_';
     $section_id = 'background_image';
     $section = $wp_customize->get_section($section_id);
     $priority = new TTFMAKE_Prioritizer(10, 5);
     // Move and rename Background Color control to General section of Color Scheme panel
     $wp_customize->get_control('background_color')->section = $theme_prefix . 'color-background';
     $wp_customize->get_control('background_color')->label = __('Site Background Color', 'make');
     // Move Background Image section to General panel
     $section->panel = $theme_prefix . 'general';
     // Set Background Image section priority
     $logo_priority = $wp_customize->get_section($theme_prefix . 'logo')->priority;
     $section->priority = $logo_priority + 5;
     // Adjust section title if no panel support
     if (!ttfmake_customizer_supports_panels()) {
         $panels = ttfmake_customizer_get_panels();
         if (isset($panels['general']['title'])) {
             $section->title = $panels['general']['title'] . ': ' . $section->title;
         }
     }
     // Rename Background Image controls
     $wp_customize->get_control('background_image')->label = __('Site Background Image', 'make');
     $wp_customize->get_control('background_repeat')->label = __('Site Background Repeat', 'make');
     $wp_customize->get_control('background_position_x')->label = __('Site Background Position', 'make');
     $wp_customize->get_control('background_attachment')->label = __('Site Background Attachment', 'make');
     // Reset priorities on existing controls
     $wp_customize->get_control('background_image')->priority = $priority->add();
     $wp_customize->get_control('background_repeat')->priority = $priority->add();
     $wp_customize->get_control('background_position_x')->priority = $priority->add();
     $wp_customize->get_control('background_attachment')->priority = $priority->add();
     // Add new option for Site background image
     $options = array('background_size' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Site Background Size', 'make'), 'type' => 'radio', 'choices' => ttfmake_get_choices('background_size'))));
     $new_priority = ttfmake_customizer_add_section_options($section_id, $options, $priority->add());
     $priority->set($new_priority);
     // Add options for Main Column background image
     $options = array('main-background-image' => array('setting' => array('sanitize_callback' => 'esc_url_raw'), 'control' => array('control_type' => 'TTFMAKE_Customize_Image_Control', 'label' => __('Main Column Background Image', 'make'), 'context' => $theme_prefix . 'main-background-image')), 'main-background-repeat' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Main Column Background Repeat', 'make'), 'type' => 'radio', 'choices' => ttfmake_get_choices('main-background-repeat'))), 'main-background-position' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Main Column Background Position', 'make'), 'type' => 'radio', 'choices' => ttfmake_get_choices('main-background-position'))), 'main-background-size' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Main Column Background Size', 'make'), 'type' => 'radio', 'choices' => ttfmake_get_choices('main-background-size'))));
     $new_priority = ttfmake_customizer_add_section_options($section_id, $options, $priority->add());
     $priority->set($new_priority);
 }
Esempio n. 4
0
 /**
  * Configure settings and controls for the Navigation section.
  *
  * @since  1.0.0.
  *
  * @return void
  */
 function ttfmake_customizer_navigation()
 {
     global $wp_customize;
     $theme_prefix = 'ttfmake_';
     $section_id = 'nav';
     // The Navigation section only exists if custom menus have been created.
     if (!isset($wp_customize->get_section($section_id)->title)) {
         $wp_customize->add_section('nav');
     }
     $section = $wp_customize->get_section($section_id);
     $priority = new TTFMAKE_Prioritizer(10, 5);
     // Move Navigation section to Header panel
     $section->panel = $theme_prefix . 'header';
     // Set Navigation section priority
     $layout_priority = $wp_customize->get_section($theme_prefix . 'header')->priority;
     $section->priority = $layout_priority - 5;
     // Adjust section title if no panel support
     if (!ttfmake_customizer_supports_panels()) {
         $panels = ttfmake_customizer_get_panels();
         if (isset($panels['header']['title'])) {
             $section->title = $panels['header']['title'] . ': ' . $section->title;
         }
     }
     // Move the Social Profile Links option to the General > Social section
     $social_menu = $wp_customize->get_control('nav_menu_locations[social]');
     $social_menu->section = $theme_prefix . 'social';
     $social_menu->description = __('After you have created your custom menu for social profile links, select it here.', 'make');
     $custom_menu_text_priority = $wp_customize->get_control($theme_prefix . 'social-custom-menu-text')->priority;
     $social_menu->priority = $custom_menu_text_priority + 1;
     /**
      * Adjust Navigation section description
      *
      * Since the Social Profile Links item gets moved to another section, the part of the description that
      * states the number of menu locations is misleading.
      */
     $section->description = __('Select which menu appears in each location. You can edit your menu content on the Menus screen in the Appearance section.', 'make');
     // Add new options
     $options = array('navigation-mobile-label' => array('setting' => array('sanitize_callback' => 'esc_html', 'theme_supports' => 'menus', 'transport' => 'postMessage'), 'control' => array('label' => __('Mobile Menu Label', 'make'), 'description' => __('Resize your browser window to preview the mobile menu label.', 'make'), 'type' => 'text')));
     $new_priority = ttfmake_customizer_add_section_options($section_id, $options, $priority->add());
     $priority->set($new_priority);
 }