999, 'title' => __( 'Reset All Options', 'thebusiness' ) ); $thebusiness_settings_controls['thebusiness-customizer-reset'] = array( 'setting' => array( 'default' => $thebusiness_customizer_defaults['thebusiness-customizer-reset'], 'sanitize_callback' => 'thebusiness_customizer_reset', 'transport' => 'postmessage' ), 'control' => array( 'label' => __( 'Reset All Options', 'thebusiness' ), 'description' => __( 'Caution: Reset all options settings to default. Refresh the page after save to view the effects. ', 'thebusiness' ), 'section' => 'thebusiness-customizer-reset', 'type' => 'checkbox', 'priority' => 10 ) ); /****************************************** Removing section setting control *******************************************/ $thebusiness_remove_sections = array( 'header_image' ); $thebusiness_remove_settings_controls = array( 'display_header_text' ); $thebusiness_customizer_args = array( 'panels' => $thebusiness_panels, /*always use key panels */ 'sections' => $thebusiness_sections,/*always use key sections*/ 'settings_controls' => $thebusiness_settings_controls,/*always use key settings_controls*/ 'repeated_settings_controls' => $thebusiness_repeated_settings_controls,/*always use key sections*/ 'remove_sections' => $thebusiness_remove_sections,/*always use key remove_sections*/ 'remove_settings_controls' => $thebusiness_remove_settings_controls/*always use key remove_settings_controls*/ ); /*registering panel section setting and control start*/ function thebusiness_add_panels_sections_settings() { global $thebusiness_customizer_args; return $thebusiness_customizer_args; } add_filter( 'salient_customizer_panels_sections_settings', 'thebusiness_add_panels_sections_settings' ); /*registering panel section setting and control end*/ /** * Add postMessage support for site title and description for the Theme Customizer. * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function thebusiness_customize_register( $wp_customize ) { $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; } add_action( 'customize_register', 'thebusiness_customize_register' ); /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function thebusiness_customize_preview_js() { wp_enqueue_script( 'thebusiness-customizer', get_template_directory_uri() . '/assets/js/customizer.js', array( 'customize-preview' ), '20160105', true ); } add_action( 'customize_preview_init', 'thebusiness_customize_preview_js' ); /** * get all saved options * @param null * @return array saved options * * @since thebusiness 1.0 */ if ( ! function_exists( 'thebusiness_get_all_options' ) ) : function thebusiness_get_all_options( $merge_default = 0 ) { $thebusiness_customizer_saved_values = salient_customizer_get_all_values( ); if( 1 == $merge_default ){ global $thebusiness_customizer_defaults; if(is_array( $thebusiness_customizer_saved_values )){ $thebusiness_customizer_saved_values = array_merge($thebusiness_customizer_defaults, $thebusiness_customizer_saved_values ); } else{ $thebusiness_customizer_saved_values = $thebusiness_customizer_defaults; } } return $thebusiness_customizer_saved_values; } endif;