$value ){ // $converted[$key] = array( // 'image' => esc_url( trailingslashit( ASTHA_CUSTOMIZER_URI ) . 'assets/images/' . $key . '.png' ), // 'name' => esc_html( $value ) // ); $converted[$key]['name'] = esc_html( $value ); /** * Checking Image File Available or not in That Folder */ if( is_file( ASTHA_THEME_DIR . 'inc/customizer/assets/images/' . $key . '.png' ) ){ $converted[$key]['image'] = esc_url( trailingslashit( ASTHA_CUSTOMIZER_URI ) . 'assets/images/' . $key . '.png' ); } } return $converted; } } if( ! function_exists( 'astha_customizer_array_to_style_string' ) ){ /** * Which Value we are getting from customizer. like bellow: array (size=5) 'font-family' => string 'Roboto Condensed' (length=16) 'font-size' => string '16' (length=2) 'text-transform' => string 'capitalize' (length=10) 'font-weight' => string '400' (length=3) 'font-style' => string 'normal' (length=6) * We will change this array to as valid style tag selector and value * like: * selector{css-property:css-value;} * */ function astha_customizer_array_to_style_string( $css_selector, $array_from_mod ){ if( is_array( $array_from_mod ) && ! empty( $css_selector ) ){ $output = $css_selector . "{\n"; foreach($array_from_mod as $st_prop => $st_value){ if( $st_prop == 'font-family' && !empty( $st_value ) ){ $st_value = $st_value . ', sans-serif'; } if( $st_prop == 'font-size' && is_numeric( $st_value ) && !empty( $st_value ) ){ $st_value = $st_value . 'px'; } $output .= ! empty( $st_value ) ? $st_prop . ': ' . $st_value . ";\n" : ''; } $output .= "\n}"; return $output; } return; } }