/** * 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())); }
/** * 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); }
/** * Define the sections and settings for the Footer panel * * @since 1.3.0. * * @param array $sections The master array of Customizer sections * @return array The augmented master array */ function ttfmake_customizer_define_footer_sections($sections) { $theme_prefix = 'ttfmake_'; $panel = 'ttfmake_footer'; $footer_sections = array(); /** * Background Image */ $footer_sections['footer-background'] = array('panel' => $panel, 'title' => __('Background Image', 'make'), 'options' => array('footer-background-image' => array('setting' => array('sanitize_callback' => 'esc_url_raw'), 'control' => array('control_type' => 'TTFMAKE_Customize_Image_Control', 'label' => __('Footer Background Image', 'make'), 'context' => $theme_prefix . 'footer-background-image')), 'footer-background-repeat' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Footer Background Repeat', 'make'), 'type' => 'radio', 'choices' => ttfmake_get_choices('footer-background-repeat'))), 'footer-background-position' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Footer Background Position', 'make'), 'type' => 'radio', 'choices' => ttfmake_get_choices('footer-background-position'))), 'footer-background-size' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Footer Background Size', 'make'), 'type' => 'radio', 'choices' => ttfmake_get_choices('footer-background-size'))))); /** * Widget Areas */ $footer_sections['footer-widget'] = array('panel' => $panel, 'title' => __('Widget Areas', 'make'), 'options' => array('footer-widget-areas' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Number of Widget Areas', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices('footer-widget-areas'))))); /** * Layout */ $footer_sections['footer'] = array('panel' => $panel, 'title' => __('Layout', 'make'), 'options' => array('footer-layout' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Footer Layout', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices('footer-layout'))), 'footer-layout-line' => array('control' => array('control_type' => 'TTFMAKE_Customize_Misc_Control', 'type' => 'line')), 'footer-text' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_text', 'transport' => 'postMessage'), 'control' => array('label' => __('Footer Text', 'make'), 'type' => 'text')), 'footer-options-heading' => array('control' => array('control_type' => 'TTFMAKE_Customize_Misc_Control', 'type' => 'heading', 'label' => __('Social Icons', 'make'))), 'footer-show-social' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Show social icons in footer', 'make'), 'type' => 'checkbox')))); /** * White Label */ if (!ttfmake_is_plus()) { $footer_sections['footer-white-label'] = array('panel' => $panel, 'title' => __('White Label', 'make'), 'description' => __('Want to remove the theme byline from your website’s footer?', 'make'), 'options' => array('footer-white-label-text' => array('control' => array('control_type' => 'TTFMAKE_Customize_Misc_Control', 'type' => 'text', 'description' => 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')))))); } // Filter the definitions $footer_sections = apply_filters('make_customizer_footer_sections', $footer_sections); // Merge with master array return array_merge($sections, $footer_sections); }
/** * Generate an array of Customizer option definitions for a particular HTML element. * * @since 1.5.0. * * @param string $element * @param string $label * @param string $description * @return array */ function ttfmake_customizer_typography_group_definitions($element, $label, $description = '') { $definitions = array('typography-group-' . $element => array('control' => array('control_type' => 'TTFMAKE_Customize_Misc_Control', 'label' => $label, 'description' => $description, 'type' => 'group-title')), 'font-family-' . $element => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_font_choice'), 'control' => array('label' => __('Font Family', 'make'), 'type' => 'select', 'choices' => ttfmake_font_choices_placeholder())), 'font-style-' . $element => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('control_type' => 'TTFMAKE_Customize_Radio_Control', 'label' => __('Font Style', 'make'), 'type' => 'radio', 'mode' => 'buttonset', 'choices' => ttfmake_get_choices('font-style-' . $element))), 'font-weight-' . $element => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('control_type' => 'TTFMAKE_Customize_Radio_Control', 'label' => __('Font Weight', 'make'), 'type' => 'radio', 'mode' => 'buttonset', 'choices' => ttfmake_get_choices('font-weight-' . $element))), 'font-size-' . $element => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('control_type' => 'TTFMAKE_Customize_Range_Control', 'label' => __('Font Size (px)', 'make'), 'type' => 'range', 'input_attrs' => array('min' => 6, 'max' => 100, 'step' => 1))), 'text-transform-' . $element => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('control_type' => 'TTFMAKE_Customize_Radio_Control', 'label' => __('Text Transform', 'make'), 'type' => 'radio', 'mode' => 'buttonset', 'choices' => ttfmake_get_choices('text-transform-' . $element))), 'line-height-' . $element => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_float'), 'control' => array('control_type' => 'TTFMAKE_Customize_Range_Control', 'label' => __('Line Height (em)', 'make'), 'type' => 'range', 'input_attrs' => array('min' => 0, 'max' => 5, 'step' => 0.1))), 'letter-spacing-' . $element => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_float'), 'control' => array('control_type' => 'TTFMAKE_Customize_Range_Control', 'label' => __('Letter Spacing (px)', 'make'), 'type' => 'range', 'input_attrs' => array('min' => 0, 'max' => 10, 'step' => 0.5))), 'word-spacing-' . $element => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_float'), 'control' => array('control_type' => 'TTFMAKE_Customize_Range_Control', 'label' => __('Word Spacing (px)', 'make'), 'type' => 'range', 'input_attrs' => array('min' => 0, 'max' => 20, 'step' => 1))), 'link-underline-' . $element => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('control_type' => 'TTFMAKE_Customize_Radio_Control', 'label' => __('Link Underline', 'make'), 'type' => 'radio', 'mode' => 'buttonset', 'choices' => ttfmake_get_choices('link-underline-' . $element)))); /** * Filter the Customizer's font control definitions. * * @since 1.5.0. * * @param array $definitions Array of Customizer options and their setting and control definitions. * @param string $element The HTML element that the font properties will apply to. */ return apply_filters('make_customizer_typography_group_definitions', $definitions, $element); }
/** * Generate an array of Customizer option definitions for a particular HTML element. * * @since 1.5.0. * * @param $region * @return array */ function ttfmake_customizer_background_image_group_definitions($region) { $definitions = array($region . '-background-image' => array('setting' => array('sanitize_callback' => 'esc_url_raw'), 'control' => array('control_type' => 'TTFMAKE_Customize_Image_Control', 'label' => __('Background Image', 'make'), 'context' => 'ttfmake_' . $region . '-background-image')), $region . '-background-repeat' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Repeat', 'make'), 'type' => 'radio', 'choices' => ttfmake_get_choices($region . '-background-repeat'))), $region . '-background-position' => 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($region . '-background-position'))), $region . '-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($region . '-background-attachment'))), $region . '-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($region . '-background-size')))); /** * Filter the Customizer's background image control definitions. * * @since 1.5.0. * * @param array $definitions Array of Customizer options and their setting and control definitions. * @param string $region The site region that the background image properties will apply to. */ return apply_filters('make_customizer_background_image_group_definitions', $definitions, $region); }
/** * 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())); }
/** * Sanitize a value from a list of allowed values. * * @since 1.0.0. * * @param mixed $value The value to sanitize. * @param mixed $setting The setting for which the sanitizing is occurring. * @return mixed The sanitized value. */ function ttfmake_sanitize_choice($value, $setting) { if (is_object($setting)) { $setting = $setting->id; } $choices = ttfmake_get_choices($setting); $allowed_choices = array_keys($choices); if (!in_array($value, $allowed_choices)) { $value = ttfmake_get_default($setting); } /** * Filter the sanitized value. * * @since 1.2.3. * * @param mixed $value The sanitized value. * @param string $setting The key for the setting. */ return apply_filters('make_sanitize_choice', $value, $setting); }
/** * 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); }
/** * Define the sections and settings for the Content & Layout panel * * @since 1.3.0. * * @param array $sections The master array of Customizer sections * @return array The augmented master array */ function ttfmake_customizer_define_contentlayout_sections($sections) { $theme_prefix = 'ttfmake_'; $panel = 'ttfmake_content-layout'; $contentlayout_sections = array(); /** * Global */ $contentlayout_sections['layout-global'] = array('panel' => $panel, 'title' => __('Global', 'make'), 'options' => array('general-layout' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Site Layout', 'make'), 'type' => 'radio', 'choices' => ttfmake_get_choices('general-layout'))), 'general-sticky-label' => array('setting' => array('sanitize_callback' => 'esc_html', 'transport' => 'postMessage'), 'control' => array('label' => __('Sticky Label', 'make'), 'type' => 'text')), 'layout-global-content-heading' => array('control' => array('control_type' => 'TTFMAKE_Customize_Misc_Control', 'type' => 'heading', 'label' => __('Content Options', 'make'))), 'main-content-link-underline' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Underline links in content', 'make'), 'type' => 'checkbox')))); /** * Blog */ $prefix = 'layout-blog-'; $contentlayout_sections['layout-blog'] = array('panel' => $panel, 'title' => __('Blog (Posts Page)', 'make'), 'options' => array($prefix . 'sidebars-heading' => array('control' => array('control_type' => 'TTFMAKE_Customize_Misc_Control', 'type' => 'heading', 'label' => __('Header, Footer, Sidebars', 'make'))), $prefix . 'hide-header' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Hide site header', 'make'), 'type' => 'checkbox')), $prefix . 'hide-footer' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Hide site footer', 'make'), 'type' => 'checkbox')), $prefix . 'sidebar-left' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Show left sidebar', 'make'), 'type' => 'checkbox')), $prefix . 'sidebar-right' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Show right sidebar', 'make'), 'type' => 'checkbox')), $prefix . 'sidebars-line' => array('control' => array('control_type' => 'TTFMAKE_Customize_Misc_Control', 'type' => 'line')), $prefix . 'featured-images' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Featured Images', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'featured-images'))), $prefix . 'featured-images-alignment' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Featured Images Alignment', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'featured-images-alignment'))), $prefix . 'post-date' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Post Date', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'post-date'))), $prefix . 'post-date-location' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Post Date Location', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'post-date-location'))), $prefix . 'post-author' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Post Author', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'post-author'))), $prefix . 'post-author-location' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Post Author Location', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'post-author-location'))), $prefix . 'content-heading' => array('control' => array('control_type' => 'TTFMAKE_Customize_Misc_Control', 'type' => 'heading', 'label' => __('Content', 'make'))), $prefix . 'auto-excerpt' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Generate excerpts automatically', 'make'), 'type' => 'checkbox')), $prefix . 'postmeta-heading' => array('control' => array('control_type' => 'TTFMAKE_Customize_Misc_Control', 'type' => 'heading', 'label' => __('Post Meta', 'make'))), $prefix . 'show-categories' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Show categories', 'make'), 'type' => 'checkbox')), $prefix . 'show-tags' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Show tags', 'make'), 'type' => 'checkbox')), $prefix . 'comment-count' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Comment Count', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'comment-count'))), $prefix . 'comment-count-location' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Comment Count Location', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'comment-count-location'))))); /** * Archives */ $prefix = 'layout-archive-'; $contentlayout_sections['layout-archive'] = array('panel' => $panel, 'title' => __('Archives', 'make'), 'options' => array($prefix . 'sidebars-heading' => array('control' => array('control_type' => 'TTFMAKE_Customize_Misc_Control', 'type' => 'heading', 'label' => __('Header, Footer, Sidebars', 'make'))), $prefix . 'hide-header' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Hide site header', 'make'), 'type' => 'checkbox')), $prefix . 'hide-footer' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Hide site footer', 'make'), 'type' => 'checkbox')), $prefix . 'sidebar-left' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Show left sidebar', 'make'), 'type' => 'checkbox')), $prefix . 'sidebar-right' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Show right sidebar', 'make'), 'type' => 'checkbox')), $prefix . 'sidebars-line' => array('control' => array('control_type' => 'TTFMAKE_Customize_Misc_Control', 'type' => 'line')), $prefix . 'featured-images' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Featured Images', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'featured-images'))), $prefix . 'featured-images-alignment' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Featured Images Alignment', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'featured-images-alignment'))), $prefix . 'post-date' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Post Date', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'post-date'))), $prefix . 'post-date-location' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Post Date Location', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'post-date-location'))), $prefix . 'post-author' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Post Author', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'post-author'))), $prefix . 'post-author-location' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Post Author Location', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'post-author-location'))), $prefix . 'content-heading' => array('control' => array('control_type' => 'TTFMAKE_Customize_Misc_Control', 'type' => 'heading', 'label' => __('Content', 'make'))), $prefix . 'auto-excerpt' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Generate excerpts automatically', 'make'), 'type' => 'checkbox')), $prefix . 'postmeta-heading' => array('control' => array('control_type' => 'TTFMAKE_Customize_Misc_Control', 'type' => 'heading', 'label' => __('Post Meta', 'make'))), $prefix . 'show-categories' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Show categories', 'make'), 'type' => 'checkbox')), $prefix . 'show-tags' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Show tags', 'make'), 'type' => 'checkbox')), $prefix . 'comment-count' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Comment Count', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'comment-count'))), $prefix . 'comment-count-location' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Comment Count Location', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'comment-count-location'))))); /** * Search Results */ $prefix = 'layout-search-'; $contentlayout_sections['layout-search'] = array('panel' => $panel, 'title' => __('Search Results', 'make'), 'options' => array($prefix . 'sidebars-heading' => array('control' => array('control_type' => 'TTFMAKE_Customize_Misc_Control', 'type' => 'heading', 'label' => __('Header, Footer, Sidebars', 'make'))), $prefix . 'hide-header' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Hide site header', 'make'), 'type' => 'checkbox')), $prefix . 'hide-footer' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Hide site footer', 'make'), 'type' => 'checkbox')), $prefix . 'sidebar-left' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Show left sidebar', 'make'), 'type' => 'checkbox')), $prefix . 'sidebar-right' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Show right sidebar', 'make'), 'type' => 'checkbox')), $prefix . 'sidebars-line' => array('control' => array('control_type' => 'TTFMAKE_Customize_Misc_Control', 'type' => 'line')), $prefix . 'featured-images' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Featured Images', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'featured-images'))), $prefix . 'featured-images-alignment' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Featured Images Alignment', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'featured-images-alignment'))), $prefix . 'post-date' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Post Date', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'post-date'))), $prefix . 'post-date-location' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Post Date Location', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'post-date-location'))), $prefix . 'post-author' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Post Author', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'post-author'))), $prefix . 'post-author-location' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Post Author Location', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'post-author-location'))), $prefix . 'content-heading' => array('control' => array('control_type' => 'TTFMAKE_Customize_Misc_Control', 'type' => 'heading', 'label' => __('Content', 'make'))), $prefix . 'auto-excerpt' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Generate excerpts automatically', 'make'), 'type' => 'checkbox')), $prefix . 'postmeta-heading' => array('control' => array('control_type' => 'TTFMAKE_Customize_Misc_Control', 'type' => 'heading', 'label' => __('Post Meta', 'make'))), $prefix . 'show-categories' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Show categories', 'make'), 'type' => 'checkbox')), $prefix . 'show-tags' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Show tags', 'make'), 'type' => 'checkbox')), $prefix . 'comment-count' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Comment Count', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'comment-count'))), $prefix . 'comment-count-location' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Comment Count Location', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'comment-count-location'))))); /** * Posts */ $prefix = 'layout-post-'; $contentlayout_sections['layout-post'] = array('panel' => $panel, 'title' => __('Posts', 'make'), 'options' => array($prefix . 'sidebars-heading' => array('control' => array('control_type' => 'TTFMAKE_Customize_Misc_Control', 'type' => 'heading', 'label' => __('Header, Footer, Sidebars', 'make'))), $prefix . 'hide-header' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Hide site header', 'make'), 'type' => 'checkbox')), $prefix . 'hide-footer' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Hide site footer', 'make'), 'type' => 'checkbox')), $prefix . 'sidebar-left' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Show left sidebar', 'make'), 'type' => 'checkbox')), $prefix . 'sidebar-right' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Show right sidebar', 'make'), 'type' => 'checkbox')), $prefix . 'sidebars-line' => array('control' => array('control_type' => 'TTFMAKE_Customize_Misc_Control', 'type' => 'line')), $prefix . 'featured-images' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Featured Images', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'featured-images'))), $prefix . 'featured-images-alignment' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Featured Images Alignment', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'featured-images-alignment'))), $prefix . 'post-date' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Post Date', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'post-date'))), $prefix . 'post-date-location' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Post Date Location', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'post-date-location'))), $prefix . 'post-author' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Post Author', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'post-author'))), $prefix . 'post-author-location' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Post Author Location', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'post-author-location'))), $prefix . 'postmeta-heading' => array('control' => array('control_type' => 'TTFMAKE_Customize_Misc_Control', 'type' => 'heading', 'label' => __('Post Meta', 'make'))), $prefix . 'show-categories' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Show categories', 'make'), 'type' => 'checkbox')), $prefix . 'show-tags' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Show tags', 'make'), 'type' => 'checkbox')), $prefix . 'comment-count' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Comment Count', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'comment-count'))), $prefix . 'comment-count-location' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Comment Count Location', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'comment-count-location'))))); /** * Pages */ $prefix = 'layout-page-'; $contentlayout_sections['layout-page'] = array('panel' => $panel, 'title' => __('Pages', 'make'), 'options' => array($prefix . 'sidebars-heading' => array('control' => array('control_type' => 'TTFMAKE_Customize_Misc_Control', 'type' => 'heading', 'label' => __('Header, Footer, Sidebars', 'make'))), $prefix . 'hide-header' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Hide site header', 'make'), 'type' => 'checkbox')), $prefix . 'hide-footer' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Hide site footer', 'make'), 'type' => 'checkbox')), $prefix . 'sidebar-left' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Show left sidebar', 'make'), 'type' => 'checkbox')), $prefix . 'sidebar-right' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Show right sidebar', 'make'), 'type' => 'checkbox')), $prefix . 'sidebars-text' => array('control' => array('control_type' => 'TTFMAKE_Customize_Misc_Control', 'type' => 'text', 'description' => __('Sidebars are not available on pages using the Builder Template.', 'make'))), $prefix . 'sidebars-line' => array('control' => array('control_type' => 'TTFMAKE_Customize_Misc_Control', 'type' => 'line')), $prefix . 'pagetitle-heading' => array('control' => array('control_type' => 'TTFMAKE_Customize_Misc_Control', 'type' => 'heading', 'label' => __('Page Title', 'make'))), $prefix . 'hide-title' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Hide title', 'make'), 'type' => 'checkbox')), $prefix . 'featured-images' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Featured Images', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'featured-images'))), $prefix . 'featured-images-alignment' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Featured Images Alignment', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'featured-images-alignment'))), $prefix . 'post-date' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Post Date', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'post-date'))), $prefix . 'post-date-location' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Post Date Location', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'post-date-location'))), $prefix . 'post-author' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Post Author', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'post-author'))), $prefix . 'post-author-location' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Post Author Location', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'post-author-location'))), $prefix . 'comment-count' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Comment Count', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'comment-count'))), $prefix . 'comment-count-location' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Comment Count Location', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'comment-count-location'))))); // Filter the definitions $contentlayout_sections = apply_filters('make_customizer_contentlayout_sections', $contentlayout_sections); // Merge with master array return array_merge($sections, $contentlayout_sections); }
/** * Define the sections and settings for the General panel * * @since 1.3.0. * * @param array $sections The master array of Customizer sections * @return array The augmented master array */ function ttfmake_customizer_define_header_sections($sections) { $theme_prefix = 'ttfmake_'; $panel = 'ttfmake_header'; $header_sections = array(); /** * Background Image */ $header_sections['header-background'] = array('panel' => $panel, 'title' => __('Background Image', 'make'), 'options' => array('header-background-image' => array('setting' => array('sanitize_callback' => 'esc_url_raw'), 'control' => array('control_type' => 'TTFMAKE_Customize_Image_Control', 'label' => __('Header Background Image', 'make'), 'context' => $theme_prefix . 'header-background-image')), 'header-background-repeat' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Header Background Repeat', 'make'), 'type' => 'radio', 'choices' => ttfmake_get_choices('header-background-repeat'))), 'header-background-position' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Header Background Position', 'make'), 'type' => 'radio', 'choices' => ttfmake_get_choices('header-background-position'))), 'header-background-size' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Header Background Size', 'make'), 'type' => 'radio', 'choices' => ttfmake_get_choices('header-background-size'))))); /** * Navigation * * This is a built-in section. */ /** * Layout */ $header_sections['header'] = array('panel' => $panel, 'title' => __('Layout', 'make'), 'options' => array('header-layout' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Header Layout', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices('header-layout'))), 'header-branding-position' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Show Title/Logo On', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices('header-branding-position'))), 'header-layout-line' => array('control' => array('control_type' => 'TTFMAKE_Customize_Misc_Control', 'type' => 'line')), 'header-bar-content-layout' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Header Bar Content Layout', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices('header-bar-content-layout'))), 'header-text' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_text', 'transport' => 'postMessage'), 'control' => array('label' => __('Header Bar Text', 'make'), 'description' => __('This text only appears if a custom menu has not been assigned to the Header Bar Menu location in the Navigation section.', 'make'), 'type' => 'text')), 'header-options-heading' => array('control' => array('control_type' => 'TTFMAKE_Customize_Misc_Control', 'type' => 'heading', 'label' => __('Header Options', 'make'))), 'header-show-social' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Show social icons in Header Bar', 'make'), 'type' => 'checkbox')), 'header-show-search' => array('setting' => array('sanitize_callback' => 'absint'), 'control' => array('label' => __('Show search field in Header Bar', 'make'), 'type' => 'checkbox')))); // Filter the definitions $header_sections = apply_filters('make_customizer_header_sections', $header_sections); // Merge with master array return array_merge($sections, $header_sections); }
/** * 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())); }
/** * 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())); }
/** * Generate an array of Customizer option definitions for a particular view. * * @since 1.5.0. * * @param string $view * @return array */ function ttfmake_customizer_layout_comment_count_group_definitions($view) { $prefix = 'layout-' . $view . '-'; $definitions = array('comment-count-group-' . $view => array('control' => array('control_type' => 'TTFMAKE_Customize_Misc_Control', 'label' => __('Comment Count', 'make'), 'type' => 'group-title')), $prefix . 'comment-count' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('label' => __('Style', 'make'), 'type' => 'select', 'choices' => ttfmake_get_choices($prefix . 'comment-count'))), $prefix . 'comment-count-location' => array('setting' => array('sanitize_callback' => 'ttfmake_sanitize_choice'), 'control' => array('control_type' => 'TTFMAKE_Customize_Radio_Control', 'label' => __('Location', 'make'), 'type' => 'radio', 'mode' => 'buttonset', 'choices' => ttfmake_get_choices($prefix . 'comment-count-location')))); return $definitions; }
/** * 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’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()))); } }
/** * 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())); }
/** * 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())); }