From 556c23d41ce4bb60cf0bf4d223a6edcc49fc057d Mon Sep 17 00:00:00 2001 From: Aristeides Stathopoulos Date: Thu, 12 May 2016 17:03:33 +0300 Subject: [PATCH] fixes #951 --- assets/js/functions/set-setting-value.js | 27 ++++++++++++++++-------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/assets/js/functions/set-setting-value.js b/assets/js/functions/set-setting-value.js index a9c40f41a..d49b8f4e8 100644 --- a/assets/js/functions/set-setting-value.js +++ b/assets/js/functions/set-setting-value.js @@ -126,30 +126,39 @@ function kirkiSetSettingValue( setting, value ) { if ( undefined !== value['font-family'] ) { $select = jQuery( wp.customize.control( setting ).container.find( '.font-family select' ) ).selectize(); - selectize = $select[0].selectize; - // Update the value visually in the control - selectize.setValue( value['font-family'], true ); + if ( 'undefined' !== typeof select ) { + selectize = $select[0].selectize; + + // Update the value visually in the control + selectize.setValue( value['font-family'], true ); + } } if ( undefined !== value.variant ) { $select = jQuery( wp.customize.control( setting ).container.find( '.variant select' ) ).selectize(); - selectize = $select[0].selectize; - // Update the value visually in the control - selectize.setValue( value.variant, true ); + if ( 'undefined' !== typeof select ) { + selectize = $select[0].selectize; + + // Update the value visually in the control + selectize.setValue( value.variant, true ); + } } if ( undefined !== value.subsets ) { $select = jQuery( wp.customize.control( setting ).container.find( '.subset select' ) ).selectize(); - selectize = $select[0].selectize; - // Update the value visually in the control - selectize.setValue( value.subset, true ); + if ( 'undefined' !== typeof select ) { + selectize = $select[0].selectize; + + // Update the value visually in the control + selectize.setValue( value.subset, true ); + } }