Skip to content

Instantly share code, notes, and snippets.

@lyrathemes
Last active February 28, 2017 05:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lyrathemes/c83a7b7a3a1f0563e095b456c00045a0 to your computer and use it in GitHub Desktop.
Save lyrathemes/c83a7b7a3a1f0563e095b456c00045a0 to your computer and use it in GitHub Desktop.
<?php
add_action( 'wp_enqueue_scripts', 'vega_child_enqueue_styles' );
function vega_child_enqueue_styles() {
$parent_style = 'vega-wp-style';
$deps = array('bootstrap', 'font-awesome', 'bootstrap-social');
wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' , $deps);
$vega_wp_color_stylesheet = vega_wp_get_option('vega_wp_color_stylesheet');
wp_enqueue_style('vega-wp-color', get_template_directory_uri() . '/color-schemes/' . strtolower($vega_wp_color_stylesheet) . '.css', array() );
wp_enqueue_style( 'vega-wp-style-child',
get_stylesheet_directory_uri() . '/style.css',
array( $parent_style, 'vega-wp-color' ),
wp_get_theme()->get('Version')
);
}
function vega_wp_get_option($key){
global $vega_wp_defaults;
$parent_theme = get_template_directory();
$parent_theme_slug = basename($parent_theme);
$parent_theme_mods = get_option( "theme_mods_{$parent_theme_slug}");
$child_value = get_theme_mod($key);
if(!empty($child_value)){
$value = $child_value;
}
else if (!empty($parent_theme_mods) && isset($parent_theme_mods[$key])) {
$value = $parent_theme_mods[$key];
} else if (array_key_exists($key, $vega_wp_defaults))
$value = get_theme_mod($key, $vega_wp_defaults[$key]);
return $value;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment