Guest User

Untitled

a guest
Apr 16th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. function color_customizer($wp_customize){
  2. $wp_customize->add_section( 'theme_colors_settings', array(
  3. 'title' => __( 'Theme Colors Settings', 'themeslug' ),
  4. 'priority' => 5,
  5. ) );
  6.  
  7. $theme_colors = array();
  8.  
  9. // Navigation Background Color
  10. $theme_colors[] = array(
  11. 'slug'=>'color_section_name',
  12. 'default' => '#000000',
  13. 'label' => __('Color Section Title', 'themeslug')
  14. );
  15.  
  16. foreach( $theme_colors as $color ) {
  17.  
  18. $wp_customize->add_setting(
  19. $color['slug'], array(
  20. 'default' => $color['default'],
  21. 'sanitize_callback' => 'sanitize_hex_color',
  22. 'type' => 'option',
  23. 'capability' => 'edit_theme_options'
  24. )
  25. );
  26.  
  27. $wp_customize->add_control(
  28. new WP_Customize_Color_Control(
  29. $wp_customize,
  30. $color['slug'],
  31. array('label' => $color['label'],
  32. 'section' => 'theme_colors_settings',
  33. 'settings' => $color['slug'])
  34. )
  35. );
  36. }
  37. }
  38.  
  39. add_action( 'customize_register', 'color_customizer' );
Add Comment
Please, Sign In to add comment