/** * This function sets the default color for the content area in the Theme Customizer. */ function theme_mod_content_color($color) { // Return the current color if set if ($color) { return $color; } // Return the selected color scheme content color if set if ($selected_color_scheme = sds_get_color_scheme()) { return $selected_color_scheme['content_color']; } // Load all color schemes for this theme $color_schemes = sds_color_schemes(); // Return the default color scheme content color return $color_schemes['default']['content_color']; }
function sds_wp_enqueue_scripts() { global $sds_theme_options; // Color Schemes if ($selected_color_scheme = sds_get_color_scheme()) { wp_enqueue_style($selected_color_scheme['deps'] . '-' . $sds_theme_options['color_scheme'], get_template_directory_uri() . $selected_color_scheme['stylesheet'], array($selected_color_scheme['deps'])); } // Web Fonts if (function_exists('sds_web_fonts') && !empty($sds_theme_options['web_font'])) { $web_fonts = sds_web_fonts(); $protocol = is_ssl() ? 'https' : 'http'; if (!empty($sds_theme_options['web_font'])) { wp_enqueue_style('sds-google-web-font', $protocol . '://fonts.googleapis.com/css?family=' . $sds_theme_options['web_font']); } } // Theme Option Fonts (Social Media) if (!empty($sds_theme_options['social_media'])) { $social_networks_active = false; foreach ($sds_theme_options['social_media'] as $network => $url) { if (!empty($url)) { $social_networks_active = true; break; } } if ($social_networks_active) { wp_enqueue_style('font-awesome-css-min', get_template_directory_uri() . '/includes/css/font-awesome.min.css'); } } // Comment Replies if (is_singular()) { wp_enqueue_script('comment-reply'); } }
/** * This function determines if a specific theme mod is set, and whether or not * it is set to the default value. * * $color_scheme_properties is an optional array of keys for which to check against in the * theme defaults. */ function sds_get_theme_mod($name, $color_scheme_properties = array()) { $theme_mod = get_theme_mod($name); // Get theme mod $selected_color_scheme = sds_get_color_scheme(false); // Get selected color scheme data $color_scheme_properties = !empty($color_scheme_properties) ? $color_scheme_properties : array($name); // First make sure the theme mod isn't empty if (empty($theme_mod)) { return false; } // Next we check to make sure the theme mod isn't equal to any one of the color scheme defaults // TODO: If set, this function should return an array of $color_scheme_properties? foreach ($color_scheme_properties as $property) { // If the theme mod is equal to one of the color scheme defaults if (isset($selected_color_scheme[$property]) && $theme_mod === $selected_color_scheme[$property]) { return false; } } return $theme_mod; }