-
-
Save jayseventwo/a4239cf3f90d06375a77 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'customize_register', 'themename_customize_register' ); | |
function themename_customize_register($wp_customize) { | |
// add new section | |
$wp_customize->add_section( 'bwpy_theme_colors', array( | |
'title' => __( 'Theme Colors', 'bwpy' ), | |
'priority' => 100, | |
) ); | |
// add color picker setting | |
$wp_customize->add_setting( 'link_color', array( | |
'default' => '#ff0000' | |
) ); | |
// add color picker control | |
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'link_color', array( | |
'label' => 'Link Color', | |
'section' => 'bwpy_theme_colors', | |
'settings' => 'link_color', | |
) ) ); | |
function bwpy_customizer_head_styles() { | |
$link_color = get_theme_mod( 'link_color' ); | |
if ( $link_color != '#ffffff' ) : ?> | |
<style type="text/css"> | |
.header_bg_color { | |
background-color: <?php echo $link_color; ?>; | |
} | |
</style> | |
<?php endif; } | |
add_action( 'wp_head', 'bwpy_customizer_head_styles' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment