CHILD THEME: adding to the customizer
While the code can be added to the functions file, requiring a seperate file makes it cleaner to work with
require_once( __DIR__ . '/inc/customizer-styles.php');
SETTING UP THE NEW COLOR CONTROL
function pdog1_register_theme_customizer( $wp_customize ) {
$wp_customize->add_setting(
'pdog_social_link_color',
array(
'default' => '#000000',
'sanitize_callback' => 'esc_attr',
)
);
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
'empty',
array(
'label' => __( 'Social Links', 'pdog-storefront' ),
'section' => 'colors',
'settings' => 'pdog_social_link_color'
)
)
);
}
add_action( 'customize_register', 'pdog1_register_theme_customizer' );
THIS APPLIES THE COLOR ABOVE AS A CSS OVER-RIDE
function pdog1_customizer_css() {
?>
<style type="text/css">
#right-head .social a{ color: <?php echo get_theme_mod( 'pdog_social_link_color' ); ?>; }
</style>
<?php
}
add_action( 'wp_head', 'pdog1_customizer_css' );