-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustomizer-inputs.php
More file actions
56 lines (40 loc) · 1.54 KB
/
customizer-inputs.php
File metadata and controls
56 lines (40 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
class Color_Palette_Picker_Customize_Control extends WP_Customize_Control{
public function render_content(){
// get color palettes
$color_palettes = (array) Colorcase::colorcase_get_palettes();
// bail if no color palettes
if( $color_palettes == false || empty( $color_palettes ) ){
return;
}
?>
<ul>
<?php
foreach( $color_palettes as $color_palette_label => $color_palette_sections ){
// create unique slug
$color_palette_slug = sanitize_title( $color_palette_label );
// initialize colors array
$palette_colors = array();
echo '<li><label class="customize-palette-control-option" data-value="' . $color_palette_slug . '">';
echo '<input type="radio" name="' . $this->id . '" id="' . $this->id . '" value="' . $color_palette_slug . '" class="customize-palette-control" />';
echo '<span class="customize-palette-control-label">' . $color_palette_label . '</span>';
echo '<div class="palette-blocks">';
foreach( $color_palette_sections as $section_label => $section_areas ){
foreach( $section_areas as $section_area => $palette_color ){
// if we haven't displayed this color yet
if( !in_array( $palette_color, $palette_colors ) ){
// output the color span
echo '<div class="palette-color-block" style="background: ' . $palette_color . '; "></div>';
// add it to the palette colors array
$palette_colors[] = $palette_color;
}
}
}
echo '</div>';
}
echo '</label></li>';
?>
</ul>
<?php
}
}