Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. // Create widget background color setting
  2. $wp_customize->add_setting( 'widget_color', array(
  3. 'default' => '#ff0000',
  4. 'type' => 'theme_mod',
  5. 'sanitize_callback' => 'sanitize_hex_color',
  6. 'transport' => 'postMessage',
  7. ));
  8.  
  9. // Add widget background color control
  10. $wp_customize->add_control(
  11. new WP_Customize_Color_Control(
  12. $wp_customize,
  13. 'widget_color', array(
  14. 'label' => __( 'Widget Background Color', 'asuna' ),
  15. 'section' => 'colors',
  16. )
  17. )
  18. );
  19.  
  20. /** Insert Customizer CSS when user selects a widget color **/
  21.  
  22. function asuna_customizer_css_widget() {
  23. $widget_color = get_theme_mod('widget_color');
  24.  
  25. ?>
  26. <style type="text/css">
  27. #secondary {
  28. background-color: <?php echo $widget_color; ?>
  29. }
  30. </style>
  31. <?php
  32. }
  33. add_action( 'wp_footer', 'asuna_customizer_css_widget' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement