Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Create widget background color setting
- $wp_customize->add_setting( 'widget_color', array(
- 'default' => '#ff0000',
- 'type' => 'theme_mod',
- 'sanitize_callback' => 'sanitize_hex_color',
- 'transport' => 'postMessage',
- ));
- // Add widget background color control
- $wp_customize->add_control(
- new WP_Customize_Color_Control(
- $wp_customize,
- 'widget_color', array(
- 'label' => __( 'Widget Background Color', 'asuna' ),
- 'section' => 'colors',
- )
- )
- );
- /** Insert Customizer CSS when user selects a widget color **/
- function asuna_customizer_css_widget() {
- $widget_color = get_theme_mod('widget_color');
- ?>
- <style type="text/css">
- #secondary {
- background-color: <?php echo $widget_color; ?>
- }
- </style>
- <?php
- }
- add_action( 'wp_footer', 'asuna_customizer_css_widget' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement