add_section('spiral_notebook_header_background_color_section', array( 'title' => 'Spiral Background Color', 'priority' => 45 )); $wp_customize->add_section('spiral_notebook_sidebar_position_section', array( 'title' => 'Single Post Options', 'priority' => 46 )); /* * WP_Customize_Manager/add_setting */ $wp_customize->add_setting( 'spiral_notebook_header_background_color_setting', array( 'type' => 'theme_mod', 'default' => 'ffffff', 'sanitize_callback' => 'esc_attr', 'transport' => 'postMessage' ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'header_background_color', array( 'settings' => 'spiral_notebook_header_background_color_setting', 'section' => 'spiral_notebook_header_background_color_section', 'label' => __( 'Header Background Color', 'spiral-notebook' ), 'description' => __( 'Select the background color of the spiral rings area.', 'spiral-notebook' ), ) ) ); } add_action('customize_register', 'spiral_notebook_register_theme_customizer'); /** * Writes the Header Background related controls' values outputed to the 'head' of the document * by reading the value(s) from the theme mod value in the options table. */ function spiral_notebook_customizer_css() { if ( get_theme_mods() ) { echo ''; } } add_action( 'wp_head', 'spiral_notebook_customizer_css'); /** * Registers the Theme Customizer Preview JavaScript with WordPress. * * @package tmx */ function spiral_notebook_customizer_live_preview() { wp_enqueue_script( 'spiral-notebook-theme-customizer', get_template_directory_uri().'/assets/customizer-javascript.js', array( 'customize-preview' ), '', true ); } add_action( 'customize_preview_init', 'spiral_notebook_customizer_live_preview' );