Skip to content

Instantly share code, notes, and snippets.

@spencerfinnell
Created July 2, 2018 11:57
Show Gist options
  • Save spencerfinnell/b7c57f23dd9bff8ad5db7a97ed894f24 to your computer and use it in GitHub Desktop.
Save spencerfinnell/b7c57f23dd9bff8ad5db7a97ed894f24 to your computer and use it in GitHub Desktop.
<?php
/**
* Colors controls.
*
* @since 1.0.0
*
* @param WP_Customize_Manager $wp_customize The Customizer object.
*/
function bigbox_customize_register_colors_controls( $wp_customize ) {
$wp_customize->add_setting(
$key, [
'default' => '#fff000',
'transport' => 'postMessage',
'sanitize_callback' => 'sanitize_hex_color',
]
);
$wp_customize->add_control(
new BigBox\Customize\WP_Customize_Color_Control(
$wp_customize,
$key,
[
'label' => 'Some Color',
'section' => 'colors-palette',
'palettes' => [ '#fff000', '#ff0000' ],
]
)
);
}
add_action( 'customize_register', 'bigbox_customize_register_colors_controls', 20 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment