=> 'publish', 'posts_per_page' => -1 ) ); $posts = get_posts( $posts_args ); $query_type = 'meta_query'; $query_var = get_post_meta( $filter_id, '_query_var', true ); if ( ! empty( $posts ) ) { $options = wp_list_pluck( $posts, 'post_title', 'ID' ); } break; case 'custom_fields': $custom_field = get_post_meta( $filter_id, '_source_custom_field', true ); $get_from_field = get_post_meta( $filter_id, '_source_get_from_field_data', true ); $get_from_field = filter_var( $get_from_field, FILTER_VALIDATE_BOOLEAN ); if ( $get_from_field ) { $options = jet_smart_filters()->data->get_choices_from_field_data( array( 'field_key' => $custom_field, 'source' => get_post_meta( $filter_id, '_custom_field_source_plugin', true ), ) ); } else { $options = get_post_meta( get_the_ID(), $custom_field, true ); if ( ! is_array( $options ) ) { $options = jet_smart_filters()->data->get_options_by_field_key( $custom_field ); } else { $options = jet_smart_filters()->data->maybe_parse_repeater_options( $options ); } } $query_type = 'meta_query'; $query_var = get_post_meta( $filter_id, '_query_var', true ); break; case 'cct': $query_type = 'meta_query'; $query_var = get_post_meta( $filter_id, '_query_var', true ); $options = jet_smart_filters()->data->get_choices_from_cct_data( $query_var ); break; default: $options = get_post_meta( $filter_id, '_source_manual_input', true ); $options = ! empty( $options ) ? $options : array(); $query_type = 'meta_query'; $query_var = get_post_meta( $filter_id, '_query_var', true ); if ( ! empty( $options ) ) { $options = wp_list_pluck( $options, 'label', 'value' ); } break; } if ( $is_hierarchical ) { $query_type = 'tax_query'; } $options = jet_smart_filters()->data->maybe_include_exclude_options( $use_exclude_include, $exclude_include_options, $options ); $placeholder = get_post_meta( $filter_id, '_placeholder', true ); if ( ! $placeholder ) { $placeholder = __( 'Select...', 'jet-smart-filters' ); } if ( !empty( $options ) ) { $options = array( '' => $placeholder ) + $options; } $options = apply_filters( 'jet-smart-filters/filters/filter-options', $options, $filter_id, $this ); $result = array( 'options' => $options, 'query_type' => $query_type, 'query_var' => $query_var, 'query_var_suffix' => jet_smart_filters()->filter_types->get_filter_query_var_suffix( $filter_id ), 'content_provider' => $content_provider, 'additional_providers' => $additional_providers, 'apply_type' => $apply_type, 'apply_on' => $apply_on, 'filter_id' => $filter_id, 'is_hierarchical' => $is_hierarchical, 'query_id' => ! empty( $args['query_id'] ) ? $args['query_id'] : false, 'accessibility_label' => $this->get_accessibility_label( $filter_id ) ); if ( $current_value ) { $result['current_value'] = $current_value; } if ( $predefined_value !== false ) { $result['predefined_value'] = $predefined_value; } return $result; } public function modify_base_class( $base_class, $filter_id ) { if ( $base_class === 'jet-smart-filters-select' && filter_var( get_post_meta( $filter_id, '_is_hierarchical', true ), FILTER_VALIDATE_BOOLEAN ) ) { return 'jet-smart-filters-hierarchy'; } return $base_class; } } } _var_suffix' => jet_smart_filters()->filter_types->get_filter_query_var_suffix( $filter_id ), 'content_provider' => $content_provider, 'additional_providers' => $additional_providers, 'apply_type' => $apply_type, 'apply_on' => $apply_on, 'inputs_enabled' => $inputs_enabled, 'inputs_separators_enabled' => $inputs_separators_enabled, 'prefix' => jet_smart_filters_macros( $prefix ), 'suffix' => jet_smart_filters_macros( $suffix ), 'filter_id' => $filter_id, 'accessibility_label' => $this->get_accessibility_label( $filter_id ) ); if ( $predefined_value !== false ) { $result['predefined_value'] = $predefined_value; } return $result; } public function additional_filter_data_atts( $args ) { $additional_filter_data_atts = array(); if ( ! empty( $args['format'] ) ) { $additional_filter_data_atts['data-format'] = $args['format']; } return $additional_filter_data_atts; } } }