I'm creating a theme and I've started doing some work on the theme customizer. I'm going to do all of it in the theme functions, but I have an issue I want to figure out first:
I've added a Typography section which currently only has some color pickers that can change the color of paragraph text and links. However, it doesn't work. There's no errors, section displays with the options, but nothing changes when I change the colors. Here's my code, if anyone can help me out, I'd be thrilled :)
/* Theme Customizer Code */
function dsgn_customizer_register($wp_customize) {
$wp_customize->add_section('dsgn_typograhy', array(
'title' => __('Typography', 'dsgn'),
'description' => ('Modify the theme typography')
));
$wp_customize->add_setting('content_color', array(
'default' => '#544e4e',
));
$wp_customize->add_setting('link_color', array(
'default' => '#BF5050',
));
$wp_customize->add_control( new WP_customize_color_control($wp_customize, 'content_color', array(
'label' => __('Edit Content Text Color', 'dsgn'),
'section' => 'dsgn_typograhy',
'settings' => 'content_color'
) ));
$wp_customize->add_control( new WP_customize_color_control($wp_customize, 'link_color', array(
'label' => __('Edit Link Text Color', 'dsgn'),
'section' => 'dsgn_typograhy',
'settings' => 'link_color'
) ));
}
function dsgn_css_customizer() {
?>
<style type="text/css">
a {
color: <?php echo get_theme_mod('link_color'); ?>;
}
.entry-content p {
color: <?php echo get_theme_mod('content_color'); ?>;
}
</style>
<?php
}
add_action('wp-head', 'dsgn_css_customizer');
add_action('customize_register', 'dsgn_customizer_register');
NOTE: I tried adding another control for the body background-color and that works perfectly... I did actually already have support for background-color using this code:
// Add theme support for Custom Background
$background_args = array(
'default-color' => 'e9e9e9',
'default-image' => '',
'wp-head-callback' => '_custom_background_cb',
'admin-head-callback' => '',
'admin-preview-callback' => '',
);
add_theme_support( 'custom-background', $background_args );
When I remove that code, the option no longer works, so I'm guessing I maybe have to add some kind of support for the typography changes as well..?