Skip to content

Instantly share code, notes, and snippets.

@j-mccarthy
Created September 8, 2016 00:03
Show Gist options
  • Save j-mccarthy/a4cec6ab75439fad0097c48967860f05 to your computer and use it in GitHub Desktop.
Save j-mccarthy/a4cec6ab75439fad0097c48967860f05 to your computer and use it in GitHub Desktop.
<?php
/**
* Customizer handler.
*
* @package jmccarthy\modularTheme\Customizer;
* @since 1.0.0
* @author jmccarthy
*
*/
namespace jmccarthy\modularTheme\Customizer;
use WP_Customize_Color_Control;
add_action( 'customize_register', __NAMESPACE__ . '\register_with_customizer' );
/**
* Register settings and controls with the Customizer.
*
* @since 1.0.0
*
* @param WP_Customize_Manager $wp_customize Customizer object.
*/
function register_with_customizer() {
global $wp_customize;
$prefix = get_settings_prefix();
$wp_customize->add_setting(
$prefix . '_link_color',
array(
'default' => get_default_link_color(),
'sanitize_callback' => 'sanitize_hex_color',
)
);
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
$prefix . '_link_color',
array(
'description' => __( 'Change the default color for linked titles, menu links, post info links and more.', CHILD_TEXT_DOMAIN ),
'label' => __( 'Link Color', CHILD_TEXT_DOMAIN ),
'section' => 'colors',
'settings' => $prefix . '_link_color',
)
)
);
$wp_customize->add_setting(
$prefix . '_accent_color',
array(
'default' => get_default_accent_color(),
'sanitize_callback' => 'sanitize_hex_color',
)
);
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
$prefix . '_accent_color',
array(
'description' => __( 'Change the default color for button hovers.', 'genesis-sample' ),
'label' => __( 'Accent Color', CHILD_TEXT_DOMAIN ),
'section' => 'colors',
'settings' => $prefix . '_accent_color',
)
)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment