add_panel( 'ats_global_panel', array( 'title' => __( 'Advanced: Global', 'advanced-twenty-seventeen' ), 'priority' => $panel_priority++, ) ); $wp_customize->add_section( 'ats_general_section', array( 'title' => __( 'General', 'advanced-twenty-seventeen' ), 'panel' => 'ats_global_panel', 'priority' => $section_priority++, ) ); $wp_customize->add_setting( 'ats_general_background_image', array( 'default' => '', 'type' => 'theme_mod', ) ); $wp_customize->add_control( $this->option_background( array( 'setting' => 'ats_general_background_image', 'label' => __( 'Background Image', 'advanced-twenty-seventeen' ), 'section' => 'ats_general_section', 'priority' => $control_priority++, ), $wp_customize ) ); $wp_customize->add_setting( 'ats_general_background_repeat', array( 'default' => 'repeat', 'type' => 'theme_mod', ) ); $wp_customize->add_control( 'ats_general_background_repeat', $this->option_background_repeat( array( 'label' => __( 'Background Repeat', 'advanced-twenty-seventeen' ), 'section' => 'ats_general_section', 'priority' => $control_priority++, ) ) ); $wp_customize->add_setting( 'ats_general_background_position', array( 'default' => 'left top', 'type' => 'theme_mod', ) ); $wp_customize->add_control( 'ats_general_background_position', $this->option_background_position( array( 'label' => __( 'Background Position', 'advanced-twenty-seventeen' ), 'section' => 'ats_general_section', 'priority' => $control_priority++, ) ) ); $wp_customize->add_setting( 'ats_general_background_attachment', array( 'default' => 'inherit', 'type' => 'theme_mod', ) ); $wp_customize->add_control( 'ats_general_background_attachment', $this->option_background_attachment( array( 'label' => __( 'Background Attachment', 'advanced-twenty-seventeen' ), 'section' => 'ats_general_section', 'priority' => $control_priority++, ) ) ); $wp_customize->add_setting( 'ats_general_background_color', array( 'default' => '', 'type' => 'theme_mod', ) ); $wp_customize->add_control( $this->option_color( array( 'setting' => 'ats_general_background_color', 'label' => __( 'Background Color', 'advanced-twenty-seventeen' ), 'section' => 'ats_general_section', 'priority' => $control_priority++, ), $wp_customize ) ); $wp_customize->add_setting( 'ats_general_color', array( 'default' => '', 'type' => 'theme_mod', ) ); $wp_customize->add_control( $this->option_color( array( 'setting' => 'ats_general_color', 'label' => __( 'Text Color', 'advanced-twenty-seventeen' ), 'section' => 'ats_general_section', 'priority' => $control_priority++, ), $wp_customize ) ); $wp_customize->add_setting( 'ats_general_heading_color', array( 'default' => '', 'type' => 'theme_mod', ) ); $wp_customize->add_control( $this->option_color( array( 'setting' => 'ats_general_heading_color', 'label' => __( 'Heading Color', 'advanced-twenty-seventeen' ), 'section' => 'ats_general_section', 'priority' => $control_priority++, ), $wp_customize ) ); $wp_customize->add_setting( 'ats_general_link_color', array( 'default' => '', 'type' => 'theme_mod', ) ); $wp_customize->add_control( $this->option_color( array( 'setting' => 'ats_general_link_color', 'label' => __( 'Link Color', 'advanced-twenty-seventeen' ), 'section' => 'ats_general_section', 'priority' => $control_priority++, ), $wp_customize ) ); $wp_customize->add_setting( 'ats_general_link_color_hover', array( 'default' => '', 'type' => 'theme_mod', ) ); $wp_customize->add_control( $this->option_color( array( 'setting' => 'ats_general_link_color_hover', 'label' => __( 'Link Color on Hover', 'advanced-twenty-seventeen' ), 'section' => 'ats_general_section', 'priority' => $control_priority++, ), $wp_customize ) ); $wp_customize->add_section( 'ats_layout_section', array( 'title' => __( 'Layout', 'advanced-twenty-seventeen' ), 'panel' => 'ats_global_panel', 'priority' => $section_priority++, ) ); $wp_customize->add_setting( 'ats_site_layout', array( 'default' => 'full_width', 'type' => 'theme_mod', ) ); $wp_customize->add_control( 'ats_site_layout', array( 'label' => __( 'Layout', 'twentyseventeen' ), 'section' => 'ats_layout_section', 'type' => 'select', 'priority' => $control_priority++, 'choices' => array( 'full_width' => __( 'Full Width', 'advanced-twenty-seventeen' ), 'boxed' => __( 'Boxed', 'advanced-twenty-seventeen' ), ), ) ); // Section Header $wp_customize->add_panel( 'ats_header_panel', array( 'title' => __( 'Advanced: Header', 'advanced-twenty-seventeen' ), 'priority' => $panel_priority++, ) ); $wp_customize->add_section( 'ats_header_general_section', array( 'title' => __( 'General', 'advanced-twenty-seventeen' ), 'panel' => 'ats_header_panel', 'priority' => $section_priority++, ) ); $wp_customize->add_setting( 'ats_header_background_image', array( 'default' => '', 'type' => 'theme_mod', ) ); $wp_customize->add_control( $this->option_background( array( 'setting' => 'ats_header_background_image', 'label' => __( 'Background Image', 'advanced-twenty-seventeen' ), 'section' => 'ats_header_general_section', 'priority' => $control_priority++, ), $wp_customize ) ); $wp_customize->add_setting( 'ats_header_background_repeat', array( 'default' => 'no-repeat', 'type' => 'theme_mod', ) ); $wp_customize->add_control( 'ats_header_background_repeat', $this->option_background_repeat( array( 'label' => __( 'Background Repeat', 'advanced-twenty-seventeen' ), 'section' => 'ats_header_general_section', 'priority' => $control_priority++, ) ) ); $wp_customize->add_setting( 'ats_header_background_position', array( 'default' => 'left top', 'type' => 'theme_mod', ) ); $wp_customize->add_control( 'ats_header_background_position', $this->option_background_position( array( 'label' => __( 'Background Position', 'advanced-twenty-seventeen' ), 'section' => 'ats_header_general_section', 'priority' => $control_priority++, ) ) ); $wp_customize->add_setting( 'ats_header_general_background_color', array( 'default' => '', 'type' => 'theme_mod', ) ); $wp_customize->add_control( $this->option_color( array( 'setting' => 'ats_header_general_background_color', 'label' => __( 'Background Color', 'advanced-twenty-seventeen' ), 'section' => 'ats_header_general_section', 'priority' => $control_priority++, ), $wp_customize ) ); $wp_customize->add_section( 'ats_branding_section', array( 'title' => __( 'Site Branding', 'advanced-twenty-seventeen' ), 'panel' => 'ats_header_panel', 'priority' => $section_priority++, ) ); $wp_customize->add_setting( 'ats_branding_align', array( 'default' => 'left', 'type' => 'theme_mod', ) ); $wp_customize->add_control( 'ats_branding_align', array( 'label' => __( 'Align', 'twentyseventeen' ), 'section' => 'ats_branding_section', 'type' => 'select', 'priority' => $control_priority++, 'choices' => array( 'left' => __( 'Left', 'advanced-twenty-seventeen' ), 'center' => __( 'Center', 'advanced-twenty-seventeen' ), 'right' => __( 'Right', 'advanced-twenty-seventeen' ), ), 'description' => __( 'Horizontal align for site branding', 'advanced-twenty-seventeen' ), ) ); $wp_customize->add_setting( 'ats_header_site_title_color', array( 'default' => '', 'type' => 'theme_mod', ) ); $wp_customize->add_control( $this->option_color( array( 'setting' => 'ats_header_site_title_color', 'label' => __( 'Site Title Color', 'advanced-twenty-seventeen' ), 'section' => 'ats_branding_section', 'priority' => $control_priority++, ), $wp_customize ) ); $wp_customize->add_setting( 'ats_header_site_title_font_size', array( 'default' => '', 'type' => 'theme_mod', ) ); $wp_customize->add_control( 'ats_header_site_title_font_size', array( 'label' => __( 'Size Title Font Size', 'advanced-twenty-seventeen' ), 'section' => 'ats_branding_section', 'type' => 'text', 'priority' => $control_priority++, 'description' => __( 'For example: 36px, 1.2em, 2rem', 'advanced-twenty-seventeen' ), 'input_attrs' => array( 'placeholder' => '36px', ), ) ); $wp_customize->add_setting( 'ats_header_site_description_color', array( 'default' => '', 'type' => 'theme_mod', ) ); $wp_customize->add_control( $this->option_color( array( 'setting' => 'ats_header_site_description_color', 'label' => __( 'Site Description Color', 'advanced-twenty-seventeen' ), 'section' => 'ats_branding_section', 'priority' => $control_priority++, ), $wp_customize ) ); $wp_customize->add_section( 'ats_menu_section', array( 'title' => __( 'Menu', 'advanced-twenty-seventeen' ), 'panel' => 'ats_header_panel', 'priority' => $section_priority++, ) ); $wp_customize->add_setting( 'ats_menu_align', array( 'default' => 'left', 'type' => 'theme_mod', ) ); $wp_customize->add_control( 'ats_menu_align', array( 'label' => __( 'Align', 'twentyseventeen' ), 'section' => 'ats_menu_section', 'type' => 'select', 'priority' => $control_priority++, 'choices' => array( 'left' => __( 'Left', 'advanced-twenty-seventeen' ), 'center' => __( 'Center', 'advanced-twenty-seventeen' ), 'right' => __( 'Right', 'advanced-twenty-seventeen' ), ), 'description' => __( 'Horizontal align for menu', 'advanced-twenty-seventeen' ), ) ); $wp_customize->add_setting( 'ats_menu_background_image', array( 'default' => '', 'type' => 'theme_mod', ) ); $wp_customize->add_control( $this->option_background( array( 'setting' => 'ats_menu_background_image', 'label' => __( 'Background Image', 'advanced-twenty-seventeen' ), 'section' => 'ats_menu_section', 'priority' => $control_priority++, ), $wp_customize ) ); $wp_customize->add_setting( 'ats_menu_background_repeat', array( 'default' => 'repeat', 'type' => 'theme_mod', ) ); $wp_customize->add_control( 'ats_menu_background_repeat', $this->option_background_repeat( array( 'label' => __( 'Background Repeat', 'advanced-twenty-seventeen' ), 'section' => 'ats_menu_section', 'priority' => $control_priority++, ) ) ); $wp_customize->add_setting( 'ats_menu_background_position', array( 'default' => 'left top', 'type' => 'theme_mod', ) ); $wp_customize->add_control( 'ats_menu_background_position', $this->option_background_position( array( 'label' => __( 'Background Position', 'advanced-twenty-seventeen' ), 'section' => 'ats_menu_section', 'priority' => $control_priority++, ) ) ); $wp_customize->add_setting( 'ats_menu_background_color', array( 'default' => '', 'type' => 'theme_mod', ) ); $wp_customize->add_control( $this->option_color( array( 'setting' => 'ats_menu_background_color', 'label' => __( 'Background Color', 'advanced-twenty-seventeen' ), 'section' => 'ats_menu_section', 'priority' => $control_priority++, ), $wp_customize ) ); $wp_customize->add_setting( 'ats_menu_border_top', array( 'default' => '1px solid #eee', 'type' => 'theme_mod', ) ); $wp_customize->add_control( 'ats_menu_border_top', array( 'label' => __( 'Item Font Size', 'advanced-twenty-seventeen' ), 'section' => 'ats_menu_section', 'type' => 'text', 'priority' => $control_priority++, 'description' => __( 'For example: 1px solid #eee or none', 'advanced-twenty-seventeen' ), ) ); $wp_customize->add_setting( 'ats_menu_border_bottom', array( 'default' => '1px solid #eee', 'type' => 'theme_mod', ) ); $wp_customize->add_control( 'ats_menu_border_bottom', array( 'label' => __( 'Item Font Size', 'advanced-twenty-seventeen' ), 'section' => 'ats_menu_section', 'type' => 'text', 'priority' => $control_priority++, 'description' => __( 'For example: 1px solid #eee or none', 'advanced-twenty-seventeen' ), ) ); $wp_customize->add_setting( 'ats_menu_color', array( 'default' => '', 'type' => 'theme_mod', ) ); $wp_customize->add_control( $this->option_color( array( 'setting' => 'ats_menu_color', 'label' => __( 'Item Color', 'advanced-twenty-seventeen' ), 'section' => 'ats_menu_section', 'priority' => $control_priority++, ), $wp_customize ) ); $wp_customize->add_setting( 'ats_menu_color_hover', array( 'default' => '', 'type' => 'theme_mod', ) ); $wp_customize->add_control( $this->option_color( array( 'setting' => 'ats_menu_color_hover', 'label' => __( 'Item Color on Hover', 'advanced-twenty-seventeen' ), 'section' => 'ats_menu_section', 'priority' => $control_priority++, ), $wp_customize ) ); $wp_customize->add_setting( 'ats_menu_font_size', array( 'default' => '', 'type' => 'theme_mod', ) ); $wp_customize->add_control( 'ats_menu_font_size', array( 'label' => __( 'Item Font Size', 'advanced-twenty-seventeen' ), 'section' => 'ats_menu_section', 'type' => 'text', 'priority' => $control_priority++, 'description' => __( 'For example: 36px, 1.2em, 2rem', 'advanced-twenty-seventeen' ), 'input_attrs' => array( 'placeholder' => '14px', ), ) ); $wp_customize->add_setting( 'ats_menu_text_transform', array( 'default' => 'inherit', 'type' => 'theme_mod', ) ); $wp_customize->add_control( 'ats_menu_text_transform', $this->option_text_transform( array( 'label' => __( 'Text Transform', 'advanced-twenty-seventeen' ), 'section' => 'ats_menu_section', 'priority' => $control_priority++, ) ) ); // Section Footer $wp_customize->add_panel( 'ats_footer_panel', array( 'title' => __( 'Advanced: Footer', 'advanced-twenty-seventeen' ), 'priority' => $panel_priority++, ) ); $wp_customize->add_section( 'ats_footer_copyright_section', array( 'title' => __( 'Custom Copyright', 'advanced-twenty-seventeen' ), 'panel' => 'ats_footer_panel', 'priority' => $section_priority++, ) ); $wp_customize->add_setting( 'ats_custom_copyright', array( 'default' => __( 'Proudly powered by WordPress', 'advanced-twenty-seventeen' ), 'type' => 'theme_mod', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'ats_custom_copyright', array( 'label' => __( 'Custom Copyright', 'twentyseventeen' ), 'section' => 'ats_footer_copyright_section', 'type' => 'textarea', 'priority' => $control_priority++, ) ); // Section Custom Code $wp_customize->add_panel( 'ats_miscellaneous_panel', array( 'title' => __( 'Advanced: Miscellaneous', 'advanced-twenty-seventeen' ), 'priority' => $panel_priority++, ) ); $wp_customize->add_section( 'ats_custom_code_section', array( 'title' => __( 'Custom Code', 'advanced-twenty-seventeen' ), 'panel' => 'ats_miscellaneous_panel', 'priority' => $section_priority++, ) ); $wp_customize->add_setting( 'ats_custom_code', array( 'default' => __( '', 'advanced-twenty-seventeen' ), 'type' => 'theme_mod', ) ); $wp_customize->add_control( 'ats_custom_code', array( 'label' => __( 'Custom Code', 'twentyseventeen' ), 'section' => 'ats_custom_code_section', 'type' => 'textarea', 'priority' => $control_priority++, ) ); } public function preview_js() { wp_enqueue_script( 'ats-customize-preview', ats()->plugin_url() . '/assets/js/customize-preview.js', array( 'customize-preview' ), ats()->version, true ); } public function generate_css() { echo ''; } public function wp_footer() { if ( $custom_code = get_theme_mod( 'ats_custom_code' ) ) { echo $custom_code; } } public function body_class( $classes ) { $classes[] = 'ats-layout-' . get_theme_mod( 'ats_site_layout', 'full_width' ); return $classes; } protected function option_background( array $option, $wp_customize) { return new WP_Customize_Image_Control( $wp_customize, $option['setting'], array( 'label' => $option['label'], 'section' => $option['section'], 'priority' => $option['priority'], ) ); } protected function option_color( array $option, $wp_customize ) { return new WP_Customize_Color_Control( $wp_customize, $option['setting'], array( 'label' => $option['label'], 'mode' => 'full', 'section' => $option['section'], 'priority' => $option['priority'], ) ); } protected function option_background_repeat( $option ) { return array( 'label' => $option['label'], 'section' => $option['section'], 'type' => 'select', 'priority' => $option['priority'], 'choices' => array( 'repeat' => __( 'Repeat', 'advanced-twenty-seventeen' ), 'repeat-x' => __( 'Repeat Horizontal', 'advanced-twenty-seventeen' ), 'repeat-y' => __( 'Repeat Vertical', 'advanced-twenty-seventeen' ), 'no-repeat' => __( 'No Repeat', 'advanced-twenty-seventeen' ), ), ); } protected function option_background_position( $option ) { return array( 'label' => $option['label'], 'section' => $option['section'], 'type' => 'select', 'priority' => $option['priority'], 'choices' => array( 'left top' => __( 'Left Top', 'advanced-twenty-seventeen' ), 'left center' => __( 'Left Center', 'advanced-twenty-seventeen' ), 'left bottom' => __( 'Left Bottom', 'advanced-twenty-seventeen' ), 'right top' => __( 'Right Top', 'advanced-twenty-seventeen' ), 'right center' => __( 'Right Center', 'advanced-twenty-seventeen' ), 'right bottom' => __( 'Right Bottom', 'advanced-twenty-seventeen' ), 'center top' => __( 'Center Top', 'advanced-twenty-seventeen' ), 'center center' => __( 'Center Center', 'advanced-twenty-seventeen' ), 'center bottom' => __( 'Center Bottom', 'advanced-twenty-seventeen' ), ), ); } protected function option_background_attachment( $option ) { return array( 'label' => $option['label'], 'section' => $option['section'], 'type' => 'select', 'priority' => $option['priority'], 'choices' => array( 'scroll' => __( 'Scroll', 'advanced-twenty-seventeen' ), 'fixed' => __( 'Fixed', 'advanced-twenty-seventeen' ), 'inherit' => __( 'Inherit', 'advanced-twenty-seventeen' ), ), ); } protected function option_text_transform( $option ) { return array( 'label' => $option['label'], 'section' => $option['section'], 'type' => 'select', 'priority' => $option['priority'], 'choices' => array( 'none' => __( 'None', 'advanced-twenty-seventeen' ), 'capitalize' => __( 'Capitalize', 'advanced-twenty-seventeen' ), 'uppercase' => __( 'Uppercase', 'advanced-twenty-seventeen' ), 'lowercase' => __( 'Lowercase', 'advanced-twenty-seventeen' ), 'inherit' => __( 'Inherit', 'advanced-twenty-seventeen' ), ), ); } } return new ATS_Customizer();