'count', 'hide_empty' => 0, ); $terms = get_terms( 'category',$args ); $cat= array(); $cat[]= 'all'; if ( ! empty( $terms ) && ! is_wp_error( $terms ) ): foreach ($terms as $term) : $cat[] = $term->slug; endforeach; endif; if(!in_array($value, $cat)){ $value = 'all'; } return $value; } endif; if ( ! function_exists( 'beshop_sanitize_image' ) ) : function beshop_sanitize_image( $input ){ /* default output */ $output = ''; /* check file type */ $filetype = wp_check_filetype( $input ); $mime_type = $filetype['type']; /* only mime type "image" allowed */ if ( strpos( $mime_type, 'image' ) !== false ){ $output = $input; } return $output; } endif; //Sanitize numeric CSS values (e.g., font size, line height) if ( ! function_exists( 'beshop_sanitize_css_numeric' ) ) : function beshop_sanitize_css_numeric( $value ) { // Remove any non-numeric characters except period and minus sign $value = preg_replace( '/[^0-9.-]/', '', $value ); // If empty or not numeric, return empty string if ( empty( $value ) || ! is_numeric( $value ) ) { return ''; } // Convert to float and then to string to remove any extra characters return (string) floatval( $value ); } endif; //All sanitize function //Sanitize sns position if ( ! function_exists( 'beshop_sanitize_sns_position' ) ) : function beshop_sanitize_sns_position($value){ if(!in_array($value, array('left_search','right_search'))){ $value = 'left_search'; } return $value; } endif; if ( ! function_exists( 'beshop_img_logo_on' ) ) : function beshop_img_logo_on(){ if (has_custom_logo()) { return true; }else{ return false; } } endif; //Sanitize sidebar options if ( ! function_exists( 'beshop_sanitize_theme_font' ) ) : function beshop_sanitize_theme_font($value){ if(!in_array($value, array('Poppins','Noto Serif','Roboto','Open Sans','Lato','Montserrat','Crimson Text'))){ $value = 'Poppins'; } return $value; } endif; //Sanitize sidebar options if ( ! function_exists( 'beshop_sanitize_theme_head_font' ) ) : function beshop_sanitize_theme_head_font($value){ if(!in_array($value, array('Poppins','Noto Serif','Roboto','Open Sans','Lato','Montserrat','Crimson Text'))){ $value = 'Noto Serif'; } return $value; } endif;