public function render_content() { global $listify_customizer_colors; $name = '_customize-radio-' . $this->id; $schemes = listify_get_color_schemes(); ?> <span class="customize-control-title"><?php echo esc_html($this->label); ?> </span> <?php foreach ($schemes as $scheme => $colors) { ?> <p><label> <input <?php $this->link(); ?> name="<?php echo esc_attr($name); ?> " value="<?php echo $scheme; ?> " type="radio" <?php echo $this->generate_scheme_data($colors); ?> <?php checked($scheme, $this->value()); ?> /> <?php echo $this->generate_scheme_preview($colors); ?> <?php echo $scheme; ?> </label></p> <?php } ?> <style> .color-scheme { display: inline-block; height: 24px; vertical-align: middle; padding: 2px; border: 1px solid #ddd; margin-right: 4px; margin-top: -3px; } .color-scheme-color { display: inline-block; width: 10px; height: 24px; } </style> <?php }
function listify_get_color_scheme() { $scheme = listify_theme_mod('color-scheme'); $schemes = listify_get_color_schemes(); return $schemes[$scheme]; }
public function add_controls($wp_customize) { $this->controls = array('color-scheme' => array('label' => __('Color Scheme', 'listify'), 'type' => 'Listify_Customize_Color_Schemes_Control', 'schemes' => listify_get_color_schemes(), 'priority' => 0), 'color-header-background' => array('label' => __('Header Background Color', 'listify'), 'type' => 'WP_Customize_Color_Control'), 'color-navigation-text' => array('label' => __('Navigation Text Color', 'listify'), 'type' => 'WP_Customize_Color_Control'), 'color-link' => array('label' => __('Link Text Color', 'listify'), 'type' => 'WP_Customize_Color_Control'), 'color-body-text' => array('label' => __('Body Text Color', 'listify'), 'type' => 'WP_Customize_Color_Control'), 'color-primary' => array('label' => __('Primary Color', 'listify'), 'type' => 'WP_Customize_Color_Control'), 'color-accent' => array('label' => __('Accent Color', 'listify'), 'type' => 'WP_Customize_Color_Control'), 'color-as-seen-on-background' => array('label' => __('"As Seen On" Background Color', 'listify'), 'type' => 'WP_Customize_Color_Control'), 'color-footer-widgets-background' => array('label' => __('Footer Widgets Background Color', 'listify'), 'type' => 'WP_Customize_Color_Control'), 'color-footer-background' => array('label' => __('Footer Background Color', 'lisify'), 'type' => 'WP_Customize_Color_Control')); return $this->controls; }