Skip to content

Instantly share code, notes, and snippets.

@spencerfinnell

spencerfinnell/colors.php Secret

Created Jun 17, 2018
Embed
What would you like to do?
<?php
/**
* Get color configs.
*
* @since 1.0.0
*
* @return array
*/
function bigbox_get_theme_colors() {
return include get_template_directory() . '/app/customize/config/colors.php';
}
/**
* Get a color.
*
* @since 1.0.0
*
* @param string $key Color key.
* @return mixed String or false on no value.
*/
function bigbox_get_theme_color( $key ) {
return get_theme_mod( "color-{$key}", bigbox_get_theme_default_color( $key ) );
}
/**
* Get a default color.
*
* @since 1.0.0
*
* @param string $key Color key.
* @return mixed String or false on no default.
*/
function bigbox_get_theme_default_color( $key ) {
$colors = bigbox_get_theme_colors();
if ( isset( $colors[ $key ] ) ) {
return $colors[ $key ]['color'];
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.