999, 'title' => __( 'Reset All Options', 'bizlight' ) ); $bizlight_settings_controls['bizlight-customizer-reset'] = array( 'setting' => array( 'default' => $bizlight_customizer_defaults['bizlight-customizer-reset'], 'sanitize_callback' => 'bizlight_customizer_reset', 'transport' => 'postmessage', ), 'control' => array( 'label' => __( 'Reset All Options', 'bizlight' ), 'description' => __( 'Caution: Reset all options settings to default. Refresh the page after save to view the effects. ', 'bizlight' ), 'section' => 'bizlight-customizer-reset', 'type' => 'checkbox', 'priority' => 10, 'active_callback' => '' ) ); /****************************************** Removing section setting control *******************************************/ $bizlight_remove_sections = array( 'header_image' ); $bizlight_remove_settings_controls = array( 'header_textcolor' ); $bizlight_customizer_args = array( 'panels' => $bizlight_panels, /*always use key panels */ 'sections' => $bizlight_sections,/*always use key sections*/ 'settings_controls' => $bizlight_settings_controls,/*always use key settings_controls*/ 'repeated_settings_controls' => $bizlight_repeated_settings_controls,/*always use key sections*/ 'remove_sections' => $bizlight_remove_sections,/*always use key remove_sections*/ 'remove_settings_controls' => $bizlight_remove_settings_controls/*always use key remove_settings_controls*/ ); /*registering panel section setting and control start*/ function bizlight_add_panels_sections_settings() { global $bizlight_customizer_args; return $bizlight_customizer_args; } add_filter( 'coder_panels_sections_settings', 'bizlight_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 bizlight_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', 'bizlight_customize_register' ); /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function bizlight_customize_preview_js() { wp_enqueue_script( 'bizlight-customizer', get_template_directory_uri() . '/assets/js/customizer.js', array( 'customize-preview' ), '20160105', true ); } add_action( 'customize_preview_init', 'bizlight_customize_preview_js' ); /*upgrade to pro*/ function bizlight_customize_enqueue_scripts() { /*upgrade to pro link*/ wp_enqueue_script( 'bizlight_upgrade_pro', get_template_directory_uri() . '/assets/js/upgrade-pro.js', array( 'customize-controls', 'iris', 'underscore', 'wp-util' ), '20160105', true ); $bizlight_misc_links = array( 'upgrade_link' => esc_url( 'http://themepalace.com/shop/wordpress-themes/bizlight-pro/' ), 'upgrade_text' => __( 'Upgrade To Pro »', 'bizlight' ), 'WP_version' => get_bloginfo( 'version' ), 'old_version_message' => __( 'Some settings might be missing or disorganized in this version of WordPress. So we suggest you to upgrade to version 4.0 or better.', 'bizlight' ) ); //Add Upgrade Button, old WordPress message and color list via localized script wp_localize_script( 'bizlight_upgrade_pro', 'bizlight_misc_links', $bizlight_misc_links ); wp_enqueue_style( 'bizlight-custom-customizer', get_template_directory_uri() . '/assets/css/bizlight-customizer.css'); /*upgrade to pro link*/ } add_action( 'customize_controls_enqueue_scripts', 'bizlight_customize_enqueue_scripts' ); /** * Repeated value handling overrite * @param array $reset_options * @return void * * @since bizlight 1.0.2 */ if ( ! function_exists( 'bizlight_get_repeated_all_value' ) ) : function bizlight_get_repeated_all_value ( $repeated, $repeated_saved_values_name ) { $coder_get_customizer_all_values = coder_get_customizer_all_values( CODER_CUSTOMIZER_NAME ); $get_repeated_all_value = array(); for ( $i = 1; $i <= $repeated; $i++ ){ foreach( $repeated_saved_values_name as $coder_repeated_saved_value_name ){ if( isset($coder_get_customizer_all_values[$coder_repeated_saved_value_name.'_'.$i]) ){ $get_repeated_all_value[$i][$coder_repeated_saved_value_name] = $coder_get_customizer_all_values[$coder_repeated_saved_value_name.'_'.$i]; } } } return $get_repeated_all_value; } endif; /** * get all saved options * @param null * @return array saved options * * @since bizlight 1.0 */ if ( ! function_exists( 'bizlight_get_all_options' ) ) : function bizlight_get_all_options( $merge_default = 0 ) { $bizlight_customizer_saved_values = coder_get_customizer_all_values( CODER_CUSTOMIZER_NAME ); if( 1 == $merge_default ){ global $bizlight_customizer_defaults; if(is_array( $bizlight_customizer_saved_values )){ $bizlight_customizer_saved_values = array_merge($bizlight_customizer_defaults, $bizlight_customizer_saved_values ); } else{ $bizlight_customizer_saved_values = $bizlight_customizer_defaults; } } return $bizlight_customizer_saved_values; } endif;