Skip to content

Instantly share code, notes, and snippets.

@spencerfinnell
Created July 2, 2018 11:57
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
<?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