/** * Default theme customizations. * * @return $options an array of default theme options */ function stag_get_theme_mods($args = array()) { $defaults = array('keys_only' => false); $args = wp_parse_args($args, $defaults); $fonts = stag_all_font_choices(); $mods = array('general_settings' => array('favicon' => array('title' => __('Favicon', 'stag'), 'type' => 'WP_Customize_Image_Control', 'default' => null, 'priority' => 30), 'contact_email' => array('title' => __('Contact Form Email Address', 'stag'), 'type' => 'text', 'default' => null, 'priority' => 90), 'google_analytics' => array('title' => __('Google Analytics Tracking Code', 'stag'), 'type' => 'Stag_Customize_Textarea_Control', 'default' => null, 'priority' => 100)), 'colors' => array('background' => array('title' => __('Background Color', 'stag'), 'type' => 'WP_Customize_Color_Control', 'default' => '#ffffff'), 'accent' => array('title' => __('Accent Color', 'stag'), 'type' => 'WP_Customize_Color_Control', 'default' => '#f0ad2c')), 'layout_options' => array('layout' => array('title' => __('Homepage Layout', 'stag'), 'type' => 'Stag_Customizer_Layout_Control', 'default' => '1-2-1-2', 'choices' => array('1-2-1-2' => '1-2-1-2', '1-1-1-1' => '1-1-1-1', '1-2-2-2' => '1-2-2-2', '2-2-2-2' => '2-2-2-2')), 'custom_css' => array('title' => __('Custom CSS', 'stag'), 'type' => 'Stag_Customize_Textarea_Control', 'default' => null, 'transport' => 'refresh')), 'typography' => array('body_font' => array('title' => __('Body Font', 'stag'), 'type' => 'select', 'default' => 'Roboto Slab', 'transport' => 'refresh', 'choices' => $fonts), 'header_font' => array('title' => __('Header Font', 'stag'), 'type' => 'select', 'default' => 'Montserrat', 'transport' => 'refresh', 'choices' => $fonts), 'subset' => array('title' => __('Character Subset', 'stag'), 'type' => 'select', 'default' => 'latin', 'choices' => stag_get_google_font_subsets())), 'post_settings' => array('share_buttons' => array('title' => __('Disable Sharing Buttons', 'stag'), 'type' => 'checkbox', 'default' => 0, 'transport' => 'refresh'), 'post_categories' => array('title' => __('Include Post Category at Post Cover’s meta', 'stag'), 'type' => 'checkbox', 'default' => 0, 'transport' => 'refresh'), 'hide_author_title' => array('title' => __('Hide Author Title under Posts', 'stag'), 'type' => 'checkbox', 'default' => 0), 'show_related_posts' => array('title' => __('Show Related Posts on Single Posts', 'stag'), 'type' => 'checkbox', 'default' => 0), 'related_posts_count' => array('title' => __('Number of Related posts to show', 'stag'), 'type' => 'text', 'default' => '2'), 'show_excerpt' => array('title' => __('Show Post Excerpt on Archive pages', 'stag'), 'type' => 'checkbox', 'default' => 0, 'transport' => 'refresh'), 'excerpt_length' => array('title' => __('Post Excerpt Length (in words)', 'stag'), 'type' => 'text', 'default' => '25', 'transport' => 'refresh')), 'stag_footer' => array('copyright' => array('title' => __('Copyright Text', 'stag'), 'type' => 'Stag_Customize_Textarea_Control', 'default' => sprintf('Copyright © %d — %s', date('Y'), '<a href="http://frontendlabs.io/author/jansanchez", title="Jan Sanchez" target="_blank">Jan Sanchez</a>'))), '404_page' => array('404_custom_page' => array('title' => __('Custom 404 Page', 'stag'), 'type' => 'dropdown-pages', 'default' => '0'))); $mods = apply_filters('stag_theme_mods', $mods); /** Return all keys within all sections (for transport, etc) */ if ($args['keys_only']) { $transport = array(); foreach ($mods as $section => $settings) { foreach ($settings as $key => $setting) { if (isset($setting['transport'])) { $transport[$key] = $setting['transport']; } else { $transport[$key] = ''; } } } return $transport; } return $mods; }
/** * Sanitize the Character Subset choice. * * @since 1.0.0 * * @param string $value The value to sanitize. * @return array The sanitized value. */ function stag_sanitize_font_subset($value) { if (!array_key_exists($value, stag_get_google_font_subsets())) { $value = 'latin'; } return $value; }