/** * Register typography options to the Customizer * * @since 1.6.0 */ public function register($wp_customize) { // Get elements $elements = $this->elements(); // Return if elements are empty. This check is needed due to the filter added above if (empty($elements)) { return; } // Add General Panel $wp_customize->add_panel('wpex_typography', array('priority' => 142, 'capability' => 'edit_theme_options', 'title' => esc_html__('Typography', 'total'))); // Add General Tab with font smoothing $wp_customize->add_section('wpex_typography_general', array('title' => esc_html__('General', 'total'), 'priority' => 1, 'panel' => 'wpex_typography')); // Font Smoothing $wp_customize->add_setting('enable_font_smoothing', array('type' => 'theme_mod', 'sanitize_callback' => false)); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'enable_font_smoothing', array('label' => esc_html__('Font Smoothing', 'total'), 'section' => 'wpex_typography_general', 'settings' => 'enable_font_smoothing', 'priority' => 1, 'type' => 'checkbox', 'description' => esc_html__('Enable font-smoothing site wide. This makes fonts look a little "skinner".', 'total')))); // Font Smoothing if (!wpex_disable_google_services()) { $wp_customize->add_setting('google_fonts_in_footer', array('type' => 'theme_mod', 'sanitize_callback' => false)); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'google_fonts_in_footer', array('label' => esc_html__('Load Fonts After The Body Tag', 'total'), 'section' => 'wpex_typography_general', 'settings' => 'google_fonts_in_footer', 'priority' => 1, 'type' => 'checkbox'))); $wp_customize->add_setting('google_font_subsets', array('type' => 'theme_mod', 'default' => 'latin', 'sanitize_callback' => false)); $wp_customize->add_control(new WPEX_Customize_Multicheck_Control($wp_customize, 'google_font_subsets', array('label' => esc_html__('Font Subsets', 'total'), 'section' => 'wpex_typography_general', 'settings' => 'google_font_subsets', 'priority' => 2, 'choices' => array('latin' => 'latin', 'latin-ext' => 'latin-ext', 'cyrillic' => 'cyrillic', 'cyrillic-ext' => 'cyrillic-ext', 'greek' => 'greek', 'greek-ext' => 'greek-ext', 'vietnamese' => 'vietnamese')))); } // Lopp through elements $count = '1'; foreach ($elements as $element => $array) { $count++; // Get label $label = !empty($array['label']) ? $array['label'] : null; $exclude_attributes = !empty($array['exclude']) ? $array['exclude'] : false; $active_callback = isset($array['active_callback']) ? $array['active_callback'] : null; $transport = 'postMessage'; // all settings should use AJAX // Get attributes if (!empty($array['attributes'])) { $attributes = $array['attributes']; } else { $attributes = array('font-family', 'font-weight', 'font-style', 'text-transform', 'font-size', 'line-height', 'letter-spacing', 'font-color'); } // Allow for margin on this attribute if (isset($array['margin'])) { $attributes[] = 'margin'; } // Set keys equal to vals $attributes = array_combine($attributes, $attributes); // Exclude attributes for specific options if ($exclude_attributes) { foreach ($exclude_attributes as $key => $val) { unset($attributes[$val]); } } // Register new setting if label isn't empty if ($label) { // Define Section $wp_customize->add_section('wpex_typography_' . $element, array('title' => $label, 'priority' => $count, 'panel' => 'wpex_typography')); // Font Family if (in_array('font-family', $attributes)) { // Get default $default = !empty($array['defaults']['font-family']) ? $array['defaults']['font-family'] : NULL; // Add setting $wp_customize->add_setting($element . '_typography[font-family]', array('type' => 'theme_mod', 'default' => $default, 'transport' => $transport, 'sanitize_callback' => false)); // Add Control $wp_customize->add_control(new WPEX_Fonts_Dropdown_Custom_Control($wp_customize, $element . '_typography[font-family]', array('label' => esc_html__('Font Family', 'total'), 'section' => 'wpex_typography_' . $element, 'settings' => $element . '_typography[font-family]', 'priority' => 1, 'active_callback' => $active_callback))); } // Font Weight if (in_array('font-weight', $attributes)) { $wp_customize->add_setting($element . '_typography[font-weight]', array('type' => 'theme_mod', 'description' => esc_html__('Note: Not all Fonts support every font weight style.', 'total'), 'sanitize_callback' => false, 'transport' => $transport)); $wp_customize->add_control($element . '_typography[font-weight]', array('label' => esc_html__('Font Weight', 'total'), 'section' => 'wpex_typography_' . $element, 'settings' => $element . '_typography[font-weight]', 'priority' => 2, 'type' => 'select', 'active_callback' => $active_callback, 'choices' => array('' => esc_html__('Default', 'total'), '100' => esc_html__('Extra Light: 100', 'total'), '200' => esc_html__('Light: 200', 'total'), '300' => esc_html__('Book: 300', 'total'), '400' => esc_html__('Normal: 400', 'total'), '600' => esc_html__('Semibold: 600', 'total'), '700' => esc_html__('Bold: 700', 'total'), '800' => esc_html__('Extra Bold: 800', 'total')), 'description' => esc_html__('Important: Not all fonts support every font-weight.', 'total'))); } // Font Style if (in_array('font-style', $attributes)) { $wp_customize->add_setting($element . '_typography[font-style]', array('type' => 'theme_mod', 'sanitize_callback' => false, 'transport' => $transport)); $wp_customize->add_control($element . '_typography[font-style]', array('label' => esc_html__('Font Style', 'total'), 'section' => 'wpex_typography_' . $element, 'settings' => $element . '_typography[font-style]', 'priority' => 3, 'type' => 'select', 'active_callback' => $active_callback, 'choices' => array('' => esc_html__('Default', 'total'), 'normal' => esc_html__('Normal', 'total'), 'italic' => esc_html__('Italic', 'total')))); } // Text-Transform if (in_array('text-transform', $attributes)) { $wp_customize->add_setting($element . '_typography[text-transform]', array('type' => 'theme_mod', 'sanitize_callback' => false, 'transport' => $transport)); $wp_customize->add_control($element . '_typography[text-transform]', array('label' => esc_html__('Text Transform', 'total'), 'section' => 'wpex_typography_' . $element, 'settings' => $element . '_typography[text-transform]', 'priority' => 4, 'type' => 'select', 'active_callback' => $active_callback, 'choices' => array('' => esc_html__('Default', 'total'), 'capitalize' => esc_html__('Capitalize', 'total'), 'lowercase' => esc_html__('Lowercase', 'total'), 'uppercase' => esc_html__('Uppercase', 'total')))); } // Font Size if (in_array('font-size', $attributes)) { $wp_customize->add_setting($element . '_typography[font-size]', array('type' => 'theme_mod', 'sanitize_callback' => false, 'transport' => $transport)); $wp_customize->add_control($element . '_typography[font-size]', array('label' => esc_html__('Font Size', 'total'), 'section' => 'wpex_typography_' . $element, 'settings' => $element . '_typography[font-size]', 'priority' => 5, 'type' => 'text', 'description' => esc_html__('Value in pixels.', 'total'), 'active_callback' => $active_callback)); } // Font Color if (in_array('font-color', $attributes)) { $wp_customize->add_setting($element . '_typography[color]', array('type' => 'theme_mod', 'default' => '', 'sanitize_callback' => false, 'transport' => $transport)); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $element . '_typography_color', array('label' => esc_html__('Font Color', 'total'), 'section' => 'wpex_typography_' . $element, 'settings' => $element . '_typography[color]', 'priority' => 6, 'active_callback' => $active_callback))); } // Line Height if (in_array('line-height', $attributes)) { $wp_customize->add_setting($element . '_typography[line-height]', array('type' => 'theme_mod', 'sanitize_callback' => false, 'transport' => $transport)); $wp_customize->add_control($element . '_typography[line-height]', array('label' => esc_html__('Line Height', 'total'), 'section' => 'wpex_typography_' . $element, 'settings' => $element . '_typography[line-height]', 'priority' => 7, 'type' => 'text', 'active_callback' => $active_callback)); } // Letter Spacing if (in_array('letter-spacing', $attributes)) { $wp_customize->add_setting($element . '_typography[letter-spacing]', array('type' => 'theme_mod', 'sanitize_callback' => false, 'transport' => $transport)); $wp_customize->add_control(new WP_Customize_Control($wp_customize, $element . '_typography_letter_spacing', array('label' => esc_html__('Letter Spacing', 'total'), 'section' => 'wpex_typography_' . $element, 'settings' => $element . '_typography[letter-spacing]', 'priority' => 8, 'type' => 'text', 'active_callback' => $active_callback, 'description' => esc_html__('Value in pixels.', 'total')))); } // Margin if (in_array('margin', $attributes)) { $wp_customize->add_setting($element . '_typography[margin]', array('type' => 'theme_mod', 'sanitize_callback' => false, 'transport' => $transport)); $wp_customize->add_control($element . '_typography[margin]', array('label' => esc_html__('Margin', 'total'), 'section' => 'wpex_typography_' . $element, 'settings' => $element . '_typography[margin]', 'priority' => 9, 'type' => 'text', 'active_callback' => $active_callback, 'description' => esc_html__('Please use the following format: top right bottom left.', 'total'))); } } } }
/** * Framework Classes * * @since 2.0.0 */ public function classes() { // Classes Dir $dir = WPEX_ClASSES_DIR; // Sanitize input require_once $dir . 'sanitize-data.php'; // iLightbox require_once $dir . 'ilightbox.php'; // Image Resize require_once $dir . 'image-resize.php'; // Gallery metabox require_once $dir . 'gallery-metabox/gallery-metabox.php'; // Term colors - coming soon! //require_once( $dir .'term-colors.php' ); // Post Series if (wpex_get_mod('post_series_enable', true)) { require_once $dir . 'post-series.php'; } // Custom WP header if (wpex_get_mod('header_image_enable')) { require_once $dir . 'custom-header.php'; } // Recommend plugins if (wpex_get_mod('recommend_plugins_enable', true)) { require_once $dir . 'class-tgm-plugin-activation.php'; require_once WPEX_FRAMEWORK_DIR . 'config/tgm-plugin-activation.php'; } // Term thumbnails if (wpex_get_mod('term_thumbnails_enable', true)) { require_once $dir . 'term-thumbnails.php'; } // Remove post type slugs if (wpex_get_mod('remove_posttype_slugs')) { require_once $dir . 'remove-post-type-slugs.php'; } // Image sizes panel if (wpex_get_mod('image_sizes_enable', true)) { require_once $dir . 'image-sizes.php'; } // Admin only classes if (is_admin()) { // Category meta require_once $dir . 'category-meta.php'; // Metabox - custom fields require_once $dir . 'metabox.php'; // Custom attachment fields require_once $dir . 'attachment-fields.php'; } else { // Accent color require_once $dir . 'accent-color.php'; // Site backgrounds require_once $dir . 'site-backgrounds.php'; // Advanced styling require_once $dir . 'advanced-styling.php'; // Breadcrumbs class require_once $dir . 'breadcrumbs.php'; } // Disable Google Services - @see conditionals.php if (wpex_disable_google_services()) { require_once $dir . 'disable-google-services.php'; } // Customizer must load last to take advantage of all functions before it require_once WPEX_FRAMEWORK_DIR . 'customizer/customizer.php'; }