Skip to content

Instantly share code, notes, and snippets.

@seothemes
Last active April 16, 2019 15:06
Show Gist options
  • Save seothemes/362131bddd452c1129a92e0331bcf5a5 to your computer and use it in GitHub Desktop.
Save seothemes/362131bddd452c1129a92e0331bcf5a5 to your computer and use it in GitHub Desktop.
<?php
// Create array of variables default colors
$seo_default_colors = array(
'color-text' => '#333333',
'color-button' => '#333333',
'color-link' => '#dddddd',
'color-white' => '#ffffff',
'color-outline' => '#eeeeee',
);
// Update SCSS variables
function seo_set_variables(){
// Get the default colors
global $seo_default_colors;
// Create an array of variables
$variables = array();
// Loop through each variable and get theme_mod
foreach( $seo_default_colors as $key => $value ) {
$variables[$key] = get_theme_mod( $key, $value );
}
return $variables;
}
add_filter('wp_scss_variables', 'seo_set_variables');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment