/**
  * 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);
 }
예제 #2
0
파일: background.php 프로젝트: fovoc/make
 /**
  * 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);
 }
예제 #3
0
 /**
  * Configure settings and controls for the Site Title & Tagline section.
  *
  * @since  1.0.0.
  *
  * @return void
  */
 function ttfmake_customizer_sitetitletagline()
 {
     global $wp_customize;
     $priority = new TTFMAKE_Prioritizer(10, 1);
     $control_prefix = 'ttfmake_';
     $section = 'title_tagline';
     // Site title color
     $setting_id = 'color-site-title';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'maybe_hash_hex_color'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Site Title Color', 'make'), 'priority' => $priority->add())));
     // Change priority for Site Title
     $site_title = $wp_customize->get_control('blogname');
     $site_title->priority = $priority->add();
     // Hide Site Title
     $setting_id = 'hide-site-title';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'absint'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Hide Site Title', 'make'), 'type' => 'checkbox', 'priority' => $priority->add()));
     // Change priority for Tagline
     $site_description = $wp_customize->get_control('blogdescription');
     $site_description->priority = $priority->add();
     // Hide Tagline
     $setting_id = 'hide-tagline';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'absint'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Hide Tagline', 'make'), 'type' => 'checkbox', 'priority' => $priority->add()));
 }
예제 #4
0
 /**
  * Configure settings and controls for the General section
  *
  * @since  1.0.0.
  *
  * @param  object    $wp_customize    The global customizer object.
  * @param  string    $section         The section name.
  * @return void
  */
 function ttfmake_customizer_general($wp_customize, $section)
 {
     $priority = new TTFMAKE_Prioritizer();
     $control_prefix = 'ttfmake_';
     $setting_prefix = str_replace($control_prefix, '', $section);
     // Site Layout
     $setting_id = $setting_prefix . '-layout';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Site Layout', 'make'), 'type' => 'radio', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add()));
     // Sticky label
     $setting_id = $setting_prefix . '-sticky-label';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'esc_html', 'transport' => 'postMessage'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Sticky Label', 'make'), 'type' => 'text', 'priority' => $priority->add()));
 }
예제 #5
0
 /**
  * Configure settings and controls for the Navigation section.
  *
  * @since  1.0.0.
  *
  * @return void
  */
 function ttfmake_customizer_navigation()
 {
     global $wp_customize;
     $priority = new TTFMAKE_Prioritizer();
     $control_prefix = 'ttfmake_';
     $section = 'nav';
     // Menu Label
     $setting_id = 'navigation-mobile-label';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'esc_html', 'theme_supports' => 'menus', 'transport' => 'postMessage'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Mobile Menu Label', 'make'), 'type' => 'text', 'priority' => $priority->add()));
     // Menu Label info
     $setting_id = 'navigation-mobile-lable-info';
     $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'text', 'description' => __('Resize your browser window to preview the mobile menu label.', 'make'), 'priority' => $priority->add())));
 }
예제 #6
0
 /**
  * Configure settings and controls for the Main section.
  *
  * @since  1.0.0.
  *
  * @param  object    $wp_customize    The global customizer object.
  * @param  string    $section         The section name.
  * @return void
  */
 function ttfmake_customizer_main($wp_customize, $section)
 {
     $priority = new TTFMAKE_Prioritizer();
     $control_prefix = 'ttfmake_';
     $setting_prefix = str_replace($control_prefix, '', $section);
     // Background color
     $setting_id = $setting_prefix . '-background-color';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'maybe_hash_hex_color'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Background Color', 'make'), 'priority' => $priority->add())));
     // Background Image
     $setting_id = $setting_prefix . '-background-image';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw'));
     $wp_customize->add_control(new TTFMAKE_Customize_Image_Control($wp_customize, $control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Background Image', 'make'), 'priority' => $priority->add(), 'context' => $control_prefix . $setting_id)));
     // Background Repeat
     $setting_id = $setting_prefix . '-background-repeat';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Background Repeat', 'make'), 'type' => 'radio', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add()));
     // Background Position
     $setting_id = $setting_prefix . '-background-position';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Background Position', 'make'), 'type' => 'radio', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add()));
     // Background Size
     $setting_id = $setting_prefix . '-background-size';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Background Size', 'make'), 'type' => 'radio', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add()));
     // Content options heading
     $setting_id = $setting_prefix . '-content-heading';
     $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'heading', 'label' => __('Content Options', 'make'), 'priority' => $priority->add())));
     // Underline content links
     $setting_id = $setting_prefix . '-content-link-underline';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'absint'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Underline links in content', 'make'), 'type' => 'checkbox', 'priority' => $priority->add()));
 }
예제 #7
0
 /**
  * Configure settings and controls for the Logo section.
  *
  * @since  1.0.0.
  *
  * @param  object    $wp_customize    The global customizer object.
  * @param  string    $section         The section name.
  * @return void
  */
 function ttfmake_customizer_logo($wp_customize, $section)
 {
     $priority = new TTFMAKE_Prioritizer();
     $control_prefix = 'ttfmake_';
     $setting_prefix = str_replace($control_prefix, '', $section);
     // Regular Logo
     $setting_id = $setting_prefix . '-regular';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw'));
     $wp_customize->add_control(new TTFMAKE_Customize_Image_Control($wp_customize, $control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Regular Logo', 'make'), 'priority' => $priority->add(), 'context' => $control_prefix . $setting_id)));
     // Retina Logo
     $setting_id = $setting_prefix . '-retina';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw'));
     $wp_customize->add_control(new TTFMAKE_Customize_Image_Control($wp_customize, $control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Retina Logo (2x)', 'make'), 'priority' => $priority->add(), 'context' => $control_prefix . $setting_id)));
     // Retina info
     $setting_id = $setting_prefix . '-retina-info';
     $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'text', 'description' => __('The Retina Logo should be twice the size of the Regular Logo.', 'make'), 'priority' => $priority->add())));
     // Favicon
     $setting_id = $setting_prefix . '-favicon';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw'));
     $wp_customize->add_control(new TTFMAKE_Customize_Image_Control($wp_customize, $control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Favicon', 'make'), 'priority' => $priority->add(), 'context' => $control_prefix . $setting_id, 'extensions' => array('png', 'ico'))));
     // Favicon info
     $setting_id = $setting_prefix . '-favicon-info';
     $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'text', 'description' => __('File must be <strong>.png</strong> or <strong>.ico</strong> format. Optimal dimensions: <strong>32px x 32px</strong>.', 'make'), 'priority' => $priority->add())));
     // Apple Touch Icon
     $setting_id = $setting_prefix . '-apple-touch';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw'));
     $wp_customize->add_control(new TTFMAKE_Customize_Image_Control($wp_customize, $control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Apple Touch Icon', 'make'), 'priority' => $priority->add(), 'context' => $control_prefix . $setting_id, 'extensions' => array('png'))));
     // Apple Touch Icon info
     $setting_id = $setting_prefix . '-apple-touch-info';
     $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'text', 'description' => __('File must be <strong>.png</strong> format. Optimal dimensions: <strong>152px x 152px</strong>.', 'make'), 'priority' => $priority->add())));
 }
예제 #8
0
 /**
  * Configure settings and controls for the Colors section.
  *
  * @since  1.0.0.
  *
  * @param  object    $wp_customize    The global customizer object.
  * @param  string    $section         The section name.
  * @return void
  */
 function ttfmake_customizer_color($wp_customize, $section)
 {
     $priority = new TTFMAKE_Prioritizer();
     $control_prefix = 'ttfmake_';
     $setting_prefix = str_replace($control_prefix, '', $section);
     // Primary Color
     $setting_id = $setting_prefix . '-primary';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'maybe_hash_hex_color'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Primary Color', 'make'), 'priority' => $priority->add())));
     // Secondary Color
     $setting_id = $setting_prefix . '-secondary';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'maybe_hash_hex_color'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Secondary Color', 'make'), 'priority' => $priority->add())));
     // Text Color
     $setting_id = $setting_prefix . '-text';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'maybe_hash_hex_color'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Text Color', 'make'), 'priority' => $priority->add())));
     // Detail Color
     $setting_id = $setting_prefix . '-detail';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'maybe_hash_hex_color'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Detail Color', 'make'), 'priority' => $priority->add())));
 }
예제 #9
0
    /**
     * Configure settings and controls for the Kits section.
     *
     * @since  1.0.3.
     *
     * @param  object    $wp_customize    The global customizer object.
     * @param  string    $section         The section name.
     * @return void
     */
    function ttfmake_customizer_stylekit($wp_customize, $section)
    {
        $priority = new TTFMAKE_Prioritizer();
        $control_prefix = 'ttfmake_';
        $setting_prefix = str_replace($control_prefix, '', $section);
        // Style Kits info
        $setting_id = $setting_prefix . '-info';
        $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'text', 'description' => sprintf(__('%s to quickly apply designer-picked style choices (fonts, layout, colors) to your website.', 'make'), sprintf('<a href="%1$s" target="_blank">%2$s</a>', esc_url(ttfmake_get_plus_link('style-kits')), __('Upgrade to Make Plus', 'make'))), 'priority' => $priority->add())));
        // Style Kits heading
        $setting_id = $setting_prefix . '-heading';
        $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'heading', 'label' => __('Kits', 'make'), 'priority' => $priority->add())));
        // Style Kits dropdown
        $setting_id = $setting_prefix . '-dropdown';
        $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'text', 'description' => '
					<select>
						<option selected="selected" disabled="disabled">--- ' . __("Choose a kit", "make") . ' ---</option>
						<option disabled="disabled">' . __("Light", "make") . '</option>
						<option disabled="disabled">' . __("Dark", "make") . '</option>
						<option disabled="disabled">' . __("Modern", "make") . '</option>
						<option disabled="disabled">' . __("Creative", "make") . '</option>
						<option disabled="disabled">' . __("Vintage", "make") . '</option>
					</select>
				', 'priority' => $priority->add())));
    }
예제 #10
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);
 }
예제 #11
0
 /**
  * Configure settings and controls for the Background section.
  *
  * @since  1.0.0.
  *
  * @return void
  */
 function ttfmake_customizer_background()
 {
     global $wp_customize;
     $priority = new TTFMAKE_Prioritizer(10, 5);
     $control_prefix = 'ttfmake_';
     $section = 'background_image';
     // Rename Background Image section to Background
     $wp_customize->get_section($section)->title = __('Background', 'make');
     // Move Background Color to Background section
     $wp_customize->get_control('background_color')->section = $section;
     // Background note
     $setting_id = 'background-info';
     $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'text', 'description' => __('With the Site Layout option (under <em>General</em>) set to "Full Width", the background color and image will not be visible.', 'make'), 'priority' => $priority->add())));
     // Reset priorities on existing controls
     $wp_customize->get_control('background_color')->priority = $priority->add();
     $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();
     // Background Size
     $setting_id = 'background_size';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Background Size', 'make'), 'type' => 'radio', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add()));
 }
예제 #12
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);
 }
예제 #13
0
파일: bootstrap.php 프로젝트: jalex403/make
 /**
  * Register settings and controls for a section.
  *
  * @since  1.3.0.
  *
  * @param  string    $section             Section ID
  * @param  array     $args                Array of setting and control definitions
  * @param  int       $initial_priority    The initial priority to use for controls
  * @return int                            The last priority value assigned
  */
 function ttfmake_customizer_add_section_options($section, $args, $initial_priority = 100)
 {
     global $wp_customize;
     $priority = new TTFMAKE_Prioritizer($initial_priority, 5);
     $theme_prefix = 'ttfmake_';
     foreach ($args as $setting_id => $option) {
         // Add setting
         if (isset($option['setting'])) {
             $defaults = array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'theme_supports' => '', 'default' => ttfmake_get_default($setting_id), 'transport' => 'refresh', 'sanitize_callback' => '', 'sanitize_js_callback' => '');
             $setting = wp_parse_args($option['setting'], $defaults);
             // Add the setting arguments inline so Theme Check can verify the presence of sanitize_callback
             $wp_customize->add_setting($setting_id, array('type' => $setting['type'], 'capability' => $setting['capability'], 'theme_supports' => $setting['theme_supports'], 'default' => $setting['default'], 'transport' => $setting['transport'], 'sanitize_callback' => $setting['sanitize_callback'], 'sanitize_js_callback' => $setting['sanitize_js_callback']));
         }
         // Add control
         if (isset($option['control'])) {
             $control_id = $theme_prefix . $setting_id;
             $defaults = array('settings' => $setting_id, 'section' => $section, 'priority' => $priority->add());
             if (!isset($option['setting'])) {
                 unset($defaults['settings']);
             }
             $control = wp_parse_args($option['control'], $defaults);
             // Check for a specialized control class
             if (isset($control['control_type'])) {
                 $class = $control['control_type'];
                 $control_path = apply_filters('make_customizer_control_path', get_template_directory() . '/inc/customizer/controls/', $control);
                 $control_file = $control_path . $class . '.php';
                 if (file_exists($control_file)) {
                     require_once $control_file;
                 }
                 if (class_exists($class)) {
                     unset($control['control_type']);
                     // Dynamically generate a new class instance
                     $reflection = new ReflectionClass($class);
                     $class_instance = $reflection->newInstanceArgs(array($wp_customize, $control_id, $control));
                     $wp_customize->add_control($class_instance);
                 }
             } else {
                 $wp_customize->add_control($control_id, $control);
             }
         }
     }
     return $priority->get();
 }
예제 #14
0
 /**
  * Add the old sections and controls to the customizer for WP installations with no panel support.
  *
  * Hooked to 'customize_register' via ttfmake_customizer_init().
  *
  * @since  1.3.0.
  *
  * @param  WP_Customize_Manager    $wp_customize    Theme Customizer object.
  * @return void
  */
 function ttfmake_customizer_add_legacy_sections($wp_customize)
 {
     $path = get_template_directory() . '/inc/customizer/';
     $section_path = $path . 'legacy_sections/';
     // Get the custom controls
     require_once $path . 'controls.php';
     // Modifications for existing sections
     require_once $section_path . 'background.php';
     require_once $section_path . 'navigation.php';
     require_once $section_path . 'site-title-tagline.php';
     // List of new sections to add
     $sections = array('general' => array('title' => __('General', 'make'), 'path' => $section_path), 'stylekit' => array('title' => __('Style Kits', 'make'), 'path' => $section_path), 'font' => array('title' => __('Fonts', 'make'), 'path' => $section_path), 'color' => array('title' => __('Colors', 'make'), 'path' => $section_path), 'header' => array('title' => __('Header', 'make'), 'path' => $section_path), 'logo' => array('title' => __('Logo', 'make'), 'path' => $section_path), 'main' => array('title' => __('Main', 'make'), 'path' => $section_path), 'layout-blog' => array('title' => __('Layout: Blog (Posts Page)', 'make'), 'path' => $section_path), 'layout-archive' => array('title' => __('Layout: Archives', 'make'), 'path' => $section_path), 'layout-search' => array('title' => __('Layout: Search Results', 'make'), 'path' => $section_path), 'layout-post' => array('title' => __('Layout: Posts', 'make'), 'path' => $section_path), 'layout-page' => array('title' => __('Layout: Pages', 'make'), 'path' => $section_path), 'footer' => array('title' => __('Footer', 'make'), 'path' => $section_path), 'social' => array('title' => __('Social Profiles &amp; RSS', 'make'), 'path' => $section_path));
     if (ttfmake_is_plus()) {
         unset($sections['stylekit']);
     }
     $sections = apply_filters('make_customizer_sections', $sections);
     // Priority for first section
     $priority = new TTFMAKE_Prioritizer(0, 10);
     // Add and populate each section, if it exists
     foreach ($sections as $section => $data) {
         $file = trailingslashit($data['path']) . $section . '.php';
         if (file_exists($file)) {
             // First load the file
             require_once $file;
             // Custom priorities for built-in sections
             if ('font' === $section) {
                 $wp_customize->get_section('background_image')->priority = $priority->add();
             }
             if ('logo' === $section) {
                 $wp_customize->get_section('title_tagline')->priority = $priority->add();
             }
             if ('main' === $section) {
                 $wp_customize->get_section('nav')->priority = $priority->add();
             }
             if ('layout-blog' === $section) {
                 $wp_customize->get_section('static_front_page')->priority = $priority->add();
             }
             // Then add the section
             $section_callback = 'ttfmake_customizer_';
             $section_callback .= strpos($section, '-') ? str_replace('-', '_', $section) : $section;
             if (function_exists($section_callback)) {
                 $section_id = 'ttfmake_' . esc_attr($section);
                 // Sanitize the section title
                 if (!isset($data['title']) || !$data['title']) {
                     $data['title'] = ucfirst(esc_attr($section));
                 }
                 // Add section
                 $wp_customize->add_section($section_id, array('title' => $data['title'], 'priority' => $priority->add()));
                 // Callback to populate the section
                 call_user_func_array($section_callback, array($wp_customize, $section_id));
             }
         }
     }
 }
예제 #15
0
 /**
  * Configure settings and controls for the Layout: Pages section.
  *
  * @since  1.0.0.
  *
  * @param  object    $wp_customize    The global customizer object.
  * @param  string    $section         The section name.
  * @return void
  */
 function ttfmake_customizer_layout_page($wp_customize, $section)
 {
     $priority = new TTFMAKE_Prioritizer();
     $control_prefix = 'ttfmake_';
     $setting_prefix = str_replace($control_prefix, '', $section);
     // Header, Footer, Sidebars heading
     $setting_id = $setting_prefix . '-heading-sidebars';
     $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'heading', 'label' => __('Header, Footer, Sidebars', 'make'), 'priority' => $priority->add())));
     // Hide site header
     $setting_id = $setting_prefix . '-hide-header';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'absint'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Hide site header', 'make'), 'type' => 'checkbox', 'priority' => $priority->add()));
     // Hide site footer
     $setting_id = $setting_prefix . '-hide-footer';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'absint'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Hide site footer', 'make'), 'type' => 'checkbox', 'priority' => $priority->add()));
     // Left sidebar
     $setting_id = $setting_prefix . '-sidebar-left';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'absint'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Show left sidebar', 'make'), 'type' => 'checkbox', 'priority' => $priority->add()));
     // Right sidebar
     $setting_id = $setting_prefix . '-sidebar-right';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'absint'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Show right sidebar', 'make'), 'type' => 'checkbox', 'priority' => $priority->add()));
     // Sidebar note
     $setting_id = $setting_prefix . '-sidebar-info';
     $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'text', 'description' => __('Sidebars are not available on pages using the Builder Template.', 'make'), 'priority' => $priority->add())));
     // Page title heading
     $setting_id = $setting_prefix . '-heading-page-title';
     $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'heading', 'label' => __('Page Title', 'make'), 'priority' => $priority->add())));
     // Hide title
     $setting_id = $setting_prefix . '-hide-title';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'absint'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Hide title', 'make'), 'type' => 'checkbox', 'priority' => $priority->add()));
     // Featured images
     $setting_id = $setting_prefix . '-featured-images';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Featured Images', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add()));
     // Featured images alignment
     $setting_id = $setting_prefix . '-featured-images-alignment';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Featured Images Alignment', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add()));
     // Post date
     $setting_id = $setting_prefix . '-post-date';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Post Date', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add()));
     // Post date location
     $setting_id = $setting_prefix . '-post-date-location';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Post Date Location', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add()));
     // Post author
     $setting_id = $setting_prefix . '-post-author';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Post Author', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add()));
     // Post author location
     $setting_id = $setting_prefix . '-post-author-location';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Post Author Location', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add()));
     // Comment count
     $setting_id = $setting_prefix . '-comment-count';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Comment Count', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add()));
     // Comment count location
     $setting_id = $setting_prefix . '-comment-count-location';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Comment Count Location', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add()));
 }
예제 #16
0
 /**
  * Configure settings and controls for the Fonts section.
  *
  * @since  1.0.0.
  *
  * @param  object    $wp_customize    The global customizer object.
  * @param  string    $section         The section name.
  * @return void
  */
 function ttfmake_customizer_font($wp_customize, $section)
 {
     $priority = new TTFMAKE_Prioritizer();
     $control_prefix = 'ttfmake_';
     $setting_prefix = str_replace($control_prefix, '', $section);
     // Google font info
     $setting_id = $setting_prefix . '-google-font-info';
     $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'text', 'description' => sprintf(__('The list of Google fonts is long! You can %s before making your choices.', 'make'), sprintf('<a href="%1$s" target="_blank">%2$s</a>', esc_url('http://www.google.com/fonts/'), __('preview', 'make'))), 'priority' => $priority->add())));
     // Site title font
     $setting_id = $setting_prefix . '-site-title';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_font_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Site Title', 'make'), 'type' => 'select', 'choices' => ttfmake_all_font_choices(), 'priority' => $priority->add()));
     // Header font
     $setting_id = $setting_prefix . '-header';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_font_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Headers', 'make'), 'type' => 'select', 'choices' => ttfmake_all_font_choices(), 'priority' => $priority->add()));
     // Body font
     $setting_id = $setting_prefix . '-body';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_font_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Body', 'make'), 'type' => 'select', 'choices' => ttfmake_all_font_choices(), 'priority' => $priority->add()));
     if (false === ttfmake_is_plus()) {
         // Typekit information
         $setting_id = $setting_prefix . '-typekit-font-heading';
         $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'heading', 'label' => __('Typekit', 'make'), 'priority' => 450)));
         $setting_id = $setting_prefix . '-typekit-font-info';
         $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'text', 'description' => sprintf(__('Looking to add premium fonts from Typekit to your website? %s.', 'make'), sprintf('<a href="%1$s" target="_blank">%2$s</a>', esc_url(ttfmake_get_plus_link('typekit')), sprintf(__('Upgrade to %1$s', 'make'), 'Make Plus'))), 'priority' => 460)));
     }
     // Font family line
     $setting_id = $setting_prefix . '-family-line';
     $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'line', 'priority' => $priority->add())));
     // Site title font size
     $setting_id = $setting_prefix . '-site-title-size';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'absint'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Site Title Font Size (in px)', 'make'), 'type' => 'text', 'priority' => $priority->add()));
     // Site title font size
     $setting_id = $setting_prefix . '-site-tagline-size';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'absint'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Site Tagline Font Size (in px)', 'make'), 'type' => 'text', 'priority' => $priority->add()));
     // Navigation font size
     $setting_id = $setting_prefix . '-nav-size';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'absint'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Navigation Font Size (in px)', 'make'), 'type' => 'text', 'priority' => $priority->add()));
     // Header font size
     $setting_id = $setting_prefix . '-header-size';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'absint'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Header Font Size (in px)', 'make'), 'type' => 'text', 'priority' => $priority->add()));
     // Widget font size
     $setting_id = $setting_prefix . '-widget-size';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'absint'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Widget Font Size (in px)', 'make'), 'type' => 'text', 'priority' => $priority->add()));
     // Body font size
     $setting_id = $setting_prefix . '-body-size';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'absint'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Body Font Size (in px)', 'make'), 'type' => 'text', 'priority' => $priority->add()));
     // Font size line
     $setting_id = $setting_prefix . '-size-line';
     $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'line', 'priority' => $priority->add())));
     // Character Subset
     $setting_id = $setting_prefix . '-subset';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_font_subset'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Character Subset', 'make'), 'type' => 'select', 'choices' => ttfmake_get_google_font_subsets(), 'priority' => $priority->add()));
     // Character subset info
     $setting_id = $setting_prefix . '-subset-info';
     $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'text', 'description' => __('Not all fonts provide each of these subsets.', 'make'), 'priority' => $priority->add())));
 }
예제 #17
0
 /**
  * Configure settings and controls for the Footer section
  *
  * @since  1.0.0.
  *
  * @param  object    $wp_customize    The global customizer object.
  * @param  string    $section         The section name.
  * @return void
  */
 function ttfmake_customizer_footer($wp_customize, $section)
 {
     $priority = new TTFMAKE_Prioritizer();
     $control_prefix = 'ttfmake_';
     $setting_prefix = str_replace($control_prefix, '', $section);
     // Footer layout
     $setting_id = $setting_prefix . '-layout';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Footer Layout', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add()));
     // Footer layout line
     $setting_id = $setting_prefix . '-layout-line';
     $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'line', 'priority' => $priority->add())));
     // Footer text
     $setting_id = $setting_prefix . '-text';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_text', 'transport' => 'postMessage'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Footer Text', 'make'), 'type' => 'text', 'priority' => $priority->add()));
     // Footer text color
     $setting_id = $setting_prefix . '-text-color';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'maybe_hash_hex_color'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Footer Text Color', 'make'), 'priority' => $priority->add())));
     // Footer border color
     $setting_id = $setting_prefix . '-border-color';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'maybe_hash_hex_color'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Footer Border Color', 'make'), 'priority' => $priority->add())));
     // Background color
     $setting_id = $setting_prefix . '-background-color';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'maybe_hash_hex_color'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Footer Background Color', 'make'), 'priority' => $priority->add())));
     // Background Image
     $setting_id = $setting_prefix . '-background-image';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw'));
     $wp_customize->add_control(new TTFMAKE_Customize_Image_Control($wp_customize, $control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Footer Background Image', 'make'), 'priority' => $priority->add(), 'context' => $control_prefix . $setting_id)));
     // Background Repeat
     $setting_id = $setting_prefix . '-background-repeat';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Background Repeat', 'make'), 'type' => 'radio', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add()));
     // Background Position
     $setting_id = $setting_prefix . '-background-position';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Background Position', 'make'), 'type' => 'radio', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add()));
     // Background Size
     $setting_id = $setting_prefix . '-background-size';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Background Size', 'make'), 'type' => 'radio', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add()));
     // Footer background line
     $setting_id = $setting_prefix . '-background-line';
     $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'line', 'priority' => $priority->add())));
     // Footer widget areas
     $setting_id = $setting_prefix . '-widget-areas';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Footer Widget Areas', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add()));
     // Footer options heading
     $setting_id = $setting_prefix . '-options-heading';
     $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'heading', 'label' => __('Footer Options', 'make'), 'priority' => $priority->add())));
     // Show social icons
     $setting_id = $setting_prefix . '-show-social';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'absint'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Show social icons', 'make'), 'type' => 'checkbox', 'priority' => $priority->add()));
     if (!ttfmake_is_plus()) {
         // White Label line
         $setting_id = $setting_prefix . '-whitelabel-line';
         $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'line', 'priority' => $priority->add())));
         // White Label heading
         $setting_id = $setting_prefix . '-whitelabel-heading';
         $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'heading', 'label' => __('White Label', 'make'), 'priority' => $priority->add())));
         // White Label info
         $setting_id = $setting_prefix . '-whitelabel-make-plus';
         $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'text', 'description' => sprintf(__('Want to remove the theme byline from your website&#8217;s footer? %s.', 'make'), sprintf('<a href="%1$s" target="_blank">%2$s</a>', esc_url(ttfmake_get_plus_link('white-label')), sprintf(__('Upgrade to %1$s', 'make'), 'Make Plus'))), 'priority' => $priority->add())));
     }
 }
예제 #18
0
 /**
  * Configure settings and controls for the Header section
  *
  * @since  1.0.0.
  *
  * @param  object    $wp_customize    The global customizer object.
  * @param  string    $section         The section name.
  * @return void
  */
 function ttfmake_customizer_header($wp_customize, $section)
 {
     $priority = new TTFMAKE_Prioritizer(10, 5);
     $control_prefix = 'ttfmake_';
     $setting_prefix = str_replace($control_prefix, '', $section);
     // Header layout
     $setting_id = $setting_prefix . '-layout';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Header Layout', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add()));
     // Branding position (Layouts 1 & 3 only)
     $setting_id = $setting_prefix . '-branding-position';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Show Title/Logo On', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add()));
     // Header layout line
     $setting_id = $setting_prefix . '-layout-line';
     $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'line', 'priority' => $priority->add())));
     // Header Bar content layout
     $setting_id = $setting_prefix . '-bar-content-layout';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Header Bar Content Layout', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add()));
     // Header text
     $setting_id = $setting_prefix . '-text';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_text', 'transport' => 'postMessage'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Header Bar Text', 'make'), 'type' => 'text', 'priority' => $priority->add()));
     // Header Bar Text color
     $setting_id = $setting_prefix . '-bar-text-color';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'maybe_hash_hex_color'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Header Bar Text Color', 'make'), 'priority' => $priority->add())));
     // Header Bar Border color
     $setting_id = $setting_prefix . '-bar-border-color';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'maybe_hash_hex_color'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Header Bar Border Color', 'make'), 'priority' => $priority->add())));
     // Header Bar Background color
     $setting_id = $setting_prefix . '-bar-background-color';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'maybe_hash_hex_color'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Header Bar Background Color', 'make'), 'priority' => $priority->add())));
     // Header bar line
     $setting_id = $setting_prefix . '-bar-line';
     $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'line', 'priority' => $priority->add())));
     // Header Text color
     $setting_id = $setting_prefix . '-text-color';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'maybe_hash_hex_color'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Header Text Color', 'make'), 'priority' => $priority->add())));
     // Header Background Color
     $setting_id = $setting_prefix . '-background-color';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'maybe_hash_hex_color'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Header Background Color', 'make'), 'priority' => $priority->add())));
     // Background Image
     $setting_id = $setting_prefix . '-background-image';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw'));
     $wp_customize->add_control(new TTFMAKE_Customize_Image_Control($wp_customize, $control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Header Background Image', 'make'), 'priority' => $priority->add(), 'context' => $control_prefix . $setting_id)));
     // Background Repeat
     $setting_id = $setting_prefix . '-background-repeat';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Background Repeat', 'make'), 'type' => 'radio', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add()));
     // Background Position
     $setting_id = $setting_prefix . '-background-position';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Background Position', 'make'), 'type' => 'radio', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add()));
     // Background Size
     $setting_id = $setting_prefix . '-background-size';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Background Size', 'make'), 'type' => 'radio', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add()));
     // Header options heading
     $setting_id = $setting_prefix . '-options-heading';
     $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'heading', 'label' => __('Header Options', 'make'), 'priority' => $priority->add())));
     // Show social icons
     $setting_id = $setting_prefix . '-show-social';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'absint'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Show social icons in header bar', 'make'), 'type' => 'checkbox', 'priority' => $priority->add()));
     // Show search field
     $setting_id = $setting_prefix . '-show-search';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'absint'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Show search field in header bar', 'make'), 'type' => 'checkbox', 'priority' => $priority->add()));
 }
예제 #19
0
 /**
  * Configure settings and controls for the Layout: Archives section.
  *
  * @since  1.0.0.
  *
  * @param  object    $wp_customize    The global customizer object.
  * @param  string    $section         The section name.
  * @return void
  */
 function ttfmake_customizer_layout_archive($wp_customize, $section)
 {
     $priority = new TTFMAKE_Prioritizer();
     $control_prefix = 'ttfmake_';
     $setting_prefix = str_replace($control_prefix, '', $section);
     // Header, Footer, Sidebars heading
     $setting_id = $setting_prefix . '-heading-sidebars';
     $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'heading', 'label' => __('Header, Footer, Sidebars', 'make'), 'priority' => $priority->add())));
     // Hide site header
     $setting_id = $setting_prefix . '-hide-header';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'absint'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Hide site header', 'make'), 'type' => 'checkbox', 'priority' => $priority->add()));
     // Hide site footer
     $setting_id = $setting_prefix . '-hide-footer';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'absint'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Hide site footer', 'make'), 'type' => 'checkbox', 'priority' => $priority->add()));
     // Left sidebar
     $setting_id = $setting_prefix . '-sidebar-left';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'absint'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Show left sidebar', 'make'), 'type' => 'checkbox', 'priority' => $priority->add()));
     // Right sidebar
     $setting_id = $setting_prefix . '-sidebar-right';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'absint'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Show right sidebar', 'make'), 'type' => 'checkbox', 'priority' => $priority->add()));
     // Featured images
     $setting_id = $setting_prefix . '-featured-images';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Featured Images', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add()));
     // Featured images alignment
     $setting_id = $setting_prefix . '-featured-images-alignment';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Featured Images Alignment', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add()));
     // Post date
     $setting_id = $setting_prefix . '-post-date';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Post Date', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add()));
     // Post date location
     $setting_id = $setting_prefix . '-post-date-location';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Post Date Location', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add()));
     // Post author
     $setting_id = $setting_prefix . '-post-author';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Post Author', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add()));
     // Post author location
     $setting_id = $setting_prefix . '-post-author-location';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Post Author Location', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add()));
     // Content heading
     $setting_id = $setting_prefix . '-heading-content';
     $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'heading', 'label' => __('Content', 'make'), 'priority' => $priority->add())));
     // Auto excerpt
     $setting_id = $setting_prefix . '-auto-excerpt';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'absint'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Generate excerpts automatically', 'make'), 'type' => 'checkbox', 'priority' => $priority->add()));
     // Post meta heading
     $setting_id = $setting_prefix . '-heading-postmeta';
     $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'heading', 'label' => __('Post Meta', 'make'), 'priority' => $priority->add())));
     // Show categories
     $setting_id = $setting_prefix . '-show-categories';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'absint'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Show categories', 'make'), 'type' => 'checkbox', 'priority' => $priority->add()));
     // Show tags
     $setting_id = $setting_prefix . '-show-tags';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'absint'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Show tags', 'make'), 'type' => 'checkbox', 'priority' => $priority->add()));
     // Comment count
     $setting_id = $setting_prefix . '-comment-count';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Comment Count', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add()));
     // Comment count location
     $setting_id = $setting_prefix . '-comment-count-location';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Comment Count Location', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add()));
 }
예제 #20
0
 /**
  * Configure settings and controls for the Social section
  *
  * @since 1.0.0
  *
  * @param  object    $wp_customize    The global customizer object.
  * @param  string    $section         The section name.
  * @return void
  */
 function ttfmake_customizer_social($wp_customize, $section)
 {
     $priority = new TTFMAKE_Prioritizer();
     $control_prefix = 'ttfmake_';
     $setting_prefix = str_replace($control_prefix, '', $section);
     // Social description
     $setting_id = $setting_prefix . '-description';
     $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'text', 'description' => __('Enter the complete URL to your profile for each service below that you would like to share.', 'make'), 'priority' => $priority->add())));
     // Facebook
     $setting_id = $setting_prefix . '-facebook';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => 'Facebook', 'type' => 'text', 'priority' => $priority->add()));
     // Twitter
     $setting_id = $setting_prefix . '-twitter';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => 'Twitter', 'type' => 'text', 'priority' => $priority->add()));
     // Google +
     $setting_id = $setting_prefix . '-google-plus-square';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => 'Google +', 'type' => 'text', 'priority' => $priority->add()));
     // LinkedIn
     $setting_id = $setting_prefix . '-linkedin';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => 'LinkedIn', 'type' => 'text', 'priority' => $priority->add()));
     // Instagram
     $setting_id = $setting_prefix . '-instagram';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => 'Instagram', 'type' => 'text', 'priority' => $priority->add()));
     // Flickr
     $setting_id = $setting_prefix . '-flickr';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => 'Flickr', 'type' => 'text', 'priority' => $priority->add()));
     // YouTube
     $setting_id = $setting_prefix . '-youtube';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => 'YouTube', 'type' => 'text', 'priority' => $priority->add()));
     // Vimeo
     $setting_id = $setting_prefix . '-vimeo-square';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => 'Vimeo', 'type' => 'text', 'priority' => $priority->add()));
     // Pinterest
     $setting_id = $setting_prefix . '-pinterest';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => 'Pinterest', 'type' => 'text', 'priority' => $priority->add()));
     // Custom alternate
     $setting_id = $setting_prefix . '-custom-alternate';
     $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'text', 'description' => sprintf(__('If you would like to add a social profile that is not listed above, or change the order of the icons, use %s.', 'make'), sprintf('<a href="' . esc_url('https://thethemefoundry.com/tutorials/make/#social-profiles-and-rss') . '">%s</a>', __('this alternate method', 'make'))), 'priority' => $priority->add())));
     // Email
     $setting_id = $setting_prefix . '-email';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_email'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Email', 'make'), 'type' => 'text', 'priority' => $priority->add()));
     // RSS Heading
     $setting_id = $setting_prefix . '-rss-heading';
     $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'heading', 'label' => __('Default RSS', 'make'), 'priority' => $priority->add())));
     // Hide RSS
     $setting_id = $setting_prefix . '-hide-rss';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'absint'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Hide default RSS feed link', 'make'), 'type' => 'checkbox', 'priority' => $priority->add()));
     // Custom RSS
     $setting_id = $setting_prefix . '-custom-rss';
     $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw'));
     $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Custom RSS URL (replaces default)', 'make'), 'type' => 'text', 'priority' => $priority->add()));
 }