Custom Shades is a PHP class that can be added to any theme to allow users to change a predefined colour (color) set.
Usage:
- Place this script into the themes directory:
e.g. wp-content/themes/[MyTheme]/custom-shades.php - Edit or create your themes functions.php with the following code:
// functions.php - custom-shades require_once(TEMPLATEPATH . "/custom-shades.php");
- Within functions.php, create your default shades using arrays:
$default_colours = array( array( 'element_name' => 'Color A', 'input_var' => 'color_a', 'input_val' => '000000' ), array( 'element_name' => 'Color B', 'input_var' => 'color_b', 'input_val' => '999999' ), );
Add as many shades as you need where:
input_val = Hex value of the shade (color)
element_name = Human readable name of the element
input_var = Real name of the element used to store and retrieve shade - Create a file for your custom css within your theme directory
e.g. wp-content/themes/[MyTheme]/style.phpUse this file like a regular css stylesheet to store your color values
Replace color values with <?php shade(['input_var']); ?>;
e.g. background-color: #000000;
becomes:
background-color: <?php shade(‘color_a’); ?>; - Test changing the shades using ‘Custom Shades’ within the Themes menu
0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below..
Leave a Comment