add_section( 'afterlight_2_contact_info', array( 'title' => esc_html__( 'Contact Info', 'afterlight-2' ), 'description' => esc_html__( 'Display your location, hours, and contact information.', 'afterlight-2' ), 'priority' => 128, ) ); /* Display in Header */ $wp_customize->add_setting( 'afterlight_2_contact_info_header', array( 'sanitize_callback' => 'afterlight_2_contact_info_sanitize_checkbox', ) ); $wp_customize->add_control( 'afterlight_2_contact_info_header', array( 'label' => esc_html__( 'Display in the header', 'afterlight-2' ), 'section' => 'afterlight_2_contact_info', 'type' => 'checkbox', ) ); /* Display in Footer */ $wp_customize->add_setting( 'afterlight_2_contact_info_footer', array( 'sanitize_callback' => 'afterlight_2_contact_info_sanitize_checkbox', ) ); $wp_customize->add_control( 'afterlight_2_contact_info_footer', array( 'label' => esc_html__( 'Display in the footer', 'afterlight-2' ), 'section' => 'afterlight_2_contact_info', 'type' => 'checkbox', ) ); /* Address */ $wp_customize->add_setting( 'afterlight_2_contact_info_address', array( 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'afterlight_2_contact_info_address', array( 'label' => esc_html__( 'Address', 'afterlight-2' ), 'section' => 'afterlight_2_contact_info', 'type' => 'textarea', ) ); /* Phone */ $wp_customize->add_setting( 'afterlight_2_contact_info_phone', array( 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'afterlight_2_contact_info_phone', array( 'label' => esc_html__( 'Phone', 'afterlight-2' ), 'section' => 'afterlight_2_contact_info', 'type' => 'text', ) ); /* Email */ $wp_customize->add_setting( 'afterlight_2_contact_info_email', array( 'sanitize_callback' => 'sanitize_email', ) ); $wp_customize->add_control( 'afterlight_2_contact_info_email', array( 'label' => esc_html__( 'Email', 'afterlight-2' ), 'section' => 'afterlight_2_contact_info', 'type' => 'email', ) ); /* Hours */ $wp_customize->add_setting( 'afterlight_2_contact_info_hours', array( 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'afterlight_2_contact_info_hours', array( 'label' => esc_html__( 'Hours', 'afterlight-2' ), 'section' => 'afterlight_2_contact_info', 'type' => 'textarea', ) ); } add_action( 'customize_register', 'afterlight_2_contact_info_customize_register' ); /** * Sanitize the checkbox. * * @param boolean $input. * @return boolean */ function afterlight_2_contact_info_sanitize_checkbox( $input ) { return ( 1 == $input ? true : false ); }