Forums › Forums › Search & Filter Pro › Getting value from url
- This topic has 45 replies, 2 voices, and was last updated 8 years, 4 months ago by Anonymous.
-
Trevor(Private) July 25, 2016 at 12:01 pm #52093
What does this give you?
<?php //Get a multiple fields values by passing an array of field names //replace 1526 with the ID of your search form global $searchandfilter; $sf_current_query = $searchandfilter->get(15)->current_query(); print_r($sf_current_query); ?>
Anonymous(Private) July 25, 2016 at 3:17 pm #52108Sorry for the late reply. This is what I get using above code:
Search_Filter_Active_Query Object ( [sfid] => 15 [is_set:Search_Filter_Active_Query:private] => 1 [query_array:Search_Filter_Active_Query:private] => Array ( [_sft_aantal_personen] => Array ( [name] => Aantal personen [singular_name] => Aantal personen [all_items_label] => Alle Aantal personen [type] => taxonomy [active_terms] => Array ( [0] => Array ( [id] => 3 [name] => 15 of meer personen [value] => 15-of-meer-personen [count] => 1 ) ) ) [_sft_arrangementstype] => Array ( [name] => Arrangementstype [singular_name] => Arrangementstype [all_items_label] => Alle Arrangementstype [type] => taxonomy [active_terms] => Array ( [0] => Array ( [id] => 5 [name] => Borrelen [value] => borrelen [count] => 1 ) [1] => Array ( [id] => 31 [name] => Italiaans menu [value] => italiaans-menu [count] => 1 ) [2] => Array ( [id] => 33 [name] => Sushi menu [value] => sushi-menu [count] => 1 ) ) ) [_sft_type_boot] => Array ( [name] => Type boten [singular_name] => Type boot [all_items_label] => Alle Type boten [type] => taxonomy [active_terms] => Array ( [0] => Array ( [id] => 19 [name] => Salonboot [value] => salonboot [count] => 1 ) ) ) ) [form_fields:Search_Filter_Active_Query:private] => Array ( [_sft_aantal_personen] => Array ( [type] => taxonomy [input_type] => checkbox [heading] => 1. Met hoeveel personen bent u? [accessibility_label] => [all_items_label] => [show_count] => 1 [hide_empty] => 1 [hierarchical] => 0 [include_children] => 0 [drill_down] => 0 [sync_include_exclude] => 1 [combo_box] => 0 [operator] => and [order_by] => default [order_dir] => asc [exclude_ids] => [taxonomy_name] => aantal_personen ) [_sft_arrangementstype] => Array ( [type] => taxonomy [input_type] => checkbox [heading] => 2. Wat wilt u doen? [accessibility_label] => [all_items_label] => [show_count] => 1 [hide_empty] => 1 [hierarchical] => 1 [include_children] => 1 [drill_down] => 0 [sync_include_exclude] => 1 [combo_box] => 0 [operator] => and [order_by] => default [order_dir] => asc [exclude_ids] => [taxonomy_name] => arrangementstype ) [_sft_type_boot] => Array ( [type] => taxonomy [input_type] => checkbox [heading] => 3. Wat voor boot type wilt u? [accessibility_label] => [all_items_label] => [show_count] => 1 [hide_empty] => 1 [hierarchical] => 0 [include_children] => 0 [drill_down] => 0 [sync_include_exclude] => 1 [combo_box] => 0 [operator] => and [order_by] => default [order_dir] => asc [exclude_ids] => [taxonomy_name] => type_boot ) [_sft_type_boot_2] => Array ( [type] => taxonomy [input_type] => checkbox [heading] => [accessibility_label] => [all_items_label] => [show_count] => 1 [hide_empty] => 1 [hierarchical] => 0 [include_children] => 0 [drill_down] => 0 [sync_include_exclude] => 1 [combo_box] => 0 [operator] => and [order_by] => id [order_dir] => asc [exclude_ids] => [taxonomy_name] => type_boot_2 ) [_sft_boot_opties] => Array ( [type] => taxonomy [input_type] => checkbox [heading] => 4. Wat wilt u aan boord hebben? [accessibility_label] => [all_items_label] => [show_count] => 1 [hide_empty] => 1 [hierarchical] => 0 [include_children] => 0 [drill_down] => 0 [sync_include_exclude] => 1 [combo_box] => 0 [operator] => and [order_by] => default [order_dir] => asc [exclude_ids] => [taxonomy_name] => boot_opties ) [reset] => Array ( [type] => reset [heading] => [input_type] => button [label] => Reset ) [submit] => Array ( [type] => submit [heading] => [label] => Submit ) ) [plugin_slug] => search-filter [form_settings] => Array ( [use_template_manual_toggle] => 1 [enable_auto_count] => 1 [auto_count_refresh_mode] => 1 [auto_count_deselect_emtpy] => 0 [template_name_manual] => search.php [page_slug] => vaararrangementen [post_types] => Array ( [post] => 1 ) [post_status] => Array ( [publish] => 1 ) [use_ajax_toggle] => 1 [scroll_to_pos] => 0 [custom_scroll_to] => [treat_child_posts_as_parent] => 0 [auto_submit] => 1 [display_results_as] => shortcode [update_ajax_url] => 1 [only_results_ajax] => 1 [ajax_target] => #main-filter [results_url] => http://ontwikkeling.puur.nl/boottochtamsterdam/vaararrangementen/ [ajax_links_selector] => .pagination a [results_per_page] => 10 [exclude_post_ids] => [field_relation] => and [default_sort_by] => 0 [sticky_posts] => [default_sort_dir] => desc [default_meta_key] => _edit_last [default_sort_type] => numeric [secondary_sort_by] => 0 [secondary_sort_dir] => desc [secondary_meta_key] => _edit_last [secondary_sort_type] => numeric [taxonomies_settings] => Array ( [category] => Array ( [include_exclude] => include [ids] => ) [post_tag] => Array ( [include_exclude] => include [ids] => ) [post_format] => Array ( [include_exclude] => include [ids] => ) [aantal_personen] => Array ( [include_exclude] => include [ids] => ) [arrangementstype] => Array ( [include_exclude] => include [ids] => ) [boot_opties] => Array ( [include_exclude] => include [ids] => ) [type_boot] => Array ( [include_exclude] => include [ids] => ) [type_boot_2] => Array ( [include_exclude] => include [ids] => ) ) ) [cache_table_name] => wp_search_filter_cache [term_results_table_name] => wp_search_filter_term_results [field_values] => Array ( [_sft_aantal_personen] => Array ( [0] => 15-of-meer-personen ) [_sft_arrangementstype] => Array ( [0] => borrelen [1] => italiaans-menu [2] => sushi-menu ) [_sft_type_boot] => Array ( [0] => salonboot ) ) )
Anonymous(Private) July 25, 2016 at 3:17 pm #52109Search_Filter_Active_Query Object ( [sfid] => 15 [is_set:Search_Filter_Active_Query:private] => 1 [query_array:Search_Filter_Active_Query:private] => Array ( [_sft_aantal_personen] => Array ( [name] => Aantal personen [singular_name] => Aantal personen [all_items_label] => Alle Aantal personen [type] => taxonomy [active_terms] => Array ( [0] => Array ( [id] => 3 [name] => 15 of meer personen [value] => 15-of-meer-personen [count] => 1 ) ) ) [_sft_arrangementstype] => Array ( [name] => Arrangementstype [singular_name] => Arrangementstype [all_items_label] => Alle Arrangementstype [type] => taxonomy [active_terms] => Array ( [0] => Array ( [id] => 5 [name] => Borrelen [value] => borrelen [count] => 1 ) [1] => Array ( [id] => 31 [name] => Italiaans menu [value] => italiaans-menu [count] => 1 ) [2] => Array ( [id] => 33 [name] => Sushi menu [value] => sushi-menu [count] => 1 ) ) ) [_sft_type_boot] => Array ( [name] => Type boten [singular_name] => Type boot [all_items_label] => Alle Type boten [type] => taxonomy [active_terms] => Array ( [0] => Array ( [id] => 19 [name] => Salonboot [value] => salonboot [count] => 1 ) ) ) ) [form_fields:Search_Filter_Active_Query:private] => Array ( [_sft_aantal_personen] => Array ( [type] => taxonomy [input_type] => checkbox [heading] => 1. Met hoeveel personen bent u? [accessibility_label] => [all_items_label] => [show_count] => 1 [hide_empty] => 1 [hierarchical] => 0 [include_children] => 0 [drill_down] => 0 [sync_include_exclude] => 1 [combo_box] => 0 [operator] => and [order_by] => default [order_dir] => asc [exclude_ids] => [taxonomy_name] => aantal_personen ) [_sft_arrangementstype] => Array ( [type] => taxonomy [input_type] => checkbox [heading] => 2. Wat wilt u doen? [accessibility_label] => [all_items_label] => [show_count] => 1 [hide_empty] => 1 [hierarchical] => 1 [include_children] => 1 [drill_down] => 0 [sync_include_exclude] => 1 [combo_box] => 0 [operator] => and [order_by] => default [order_dir] => asc [exclude_ids] => [taxonomy_name] => arrangementstype ) [_sft_type_boot] => Array ( [type] => taxonomy [input_type] => checkbox [heading] => 3. Wat voor boot type wilt u? [accessibility_label] => [all_items_label] => [show_count] => 1 [hide_empty] => 1 [hierarchical] => 0 [include_children] => 0 [drill_down] => 0 [sync_include_exclude] => 1 [combo_box] => 0 [operator] => and [order_by] => default [order_dir] => asc [exclude_ids] => [taxonomy_name] => type_boot ) [_sft_type_boot_2] => Array ( [type] => taxonomy [input_type] => checkbox [heading] => [accessibility_label] => [all_items_label] => [show_count] => 1 [hide_empty] => 1 [hierarchical] => 0 [include_children] => 0 [drill_down] => 0 [sync_include_exclude] => 1 [combo_box] => 0 [operator] => and [order_by] => id [order_dir] => asc [exclude_ids] => [taxonomy_name] => type_boot_2 ) [_sft_boot_opties] => Array ( [type] => taxonomy [input_type] => checkbox [heading] => 4. Wat wilt u aan boord hebben? [accessibility_label] => [all_items_label] => [show_count] => 1 [hide_empty] => 1 [hierarchical] => 0 [include_children] => 0 [drill_down] => 0 [sync_include_exclude] => 1 [combo_box] => 0 [operator] => and [order_by] => default [order_dir] => asc [exclude_ids] => [taxonomy_name] => boot_opties ) [reset] => Array ( [type] => reset [heading] => [input_type] => button [label] => Reset ) [submit] => Array ( [type] => submit [heading] => [label] => Submit ) ) [plugin_slug] => search-filter [form_settings] => Array ( [use_template_manual_toggle] => 1 [enable_auto_count] => 1 [auto_count_refresh_mode] => 1 [auto_count_deselect_emtpy] => 0 [template_name_manual] => search.php [page_slug] => vaararrangementen [post_types] => Array ( [post] => 1 ) [post_status] => Array ( [publish] => 1 ) [use_ajax_toggle] => 1 [scroll_to_pos] => 0 [custom_scroll_to] => [treat_child_posts_as_parent] => 0 [auto_submit] => 1 [display_results_as] => shortcode [update_ajax_url] => 1 [only_results_ajax] => 1 [ajax_target] => #main-filter [results_url] => http://ontwikkeling.puur.nl/boottochtamsterdam/vaararrangementen/ [ajax_links_selector] => .pagination a [results_per_page] => 10 [exclude_post_ids] => [field_relation] => and [default_sort_by] => 0 [sticky_posts] => [default_sort_dir] => desc [default_meta_key] => _edit_last [default_sort_type] => numeric [secondary_sort_by] => 0 [secondary_sort_dir] => desc [secondary_meta_key] => _edit_last [secondary_sort_type] => numeric [taxonomies_settings] => Array ( [category] => Array ( [include_exclude] => include [ids] => ) [post_tag] => Array ( [include_exclude] => include [ids] => ) [post_format] => Array ( [include_exclude] => include [ids] => ) [aantal_personen] => Array ( [include_exclude] => include [ids] => ) [arrangementstype] => Array ( [include_exclude] => include [ids] => ) [boot_opties] => Array ( [include_exclude] => include [ids] => ) [type_boot] => Array ( [include_exclude] => include [ids] => ) [type_boot_2] => Array ( [include_exclude] => include [ids] => ) ) ) [cache_table_name] => wp_search_filter_cache [term_results_table_name] => wp_search_filter_term_results [field_values] => Array ( [_sft_aantal_personen] => Array ( [0] => 15-of-meer-personen ) [_sft_arrangementstype] => Array ( [0] => borrelen [1] => italiaans-menu [2] => sushi-menu ) [_sft_type_boot] => Array ( [0] => salonboot ) ) )
Trevor(Private) July 25, 2016 at 3:49 pm #52114What does this give?
global $searchandfilter; $sf_current_query = $searchandfilter->get(339)->current_query()->get_array(); foreach($sf_current_query as $key) { echo '<div>' . $key['name'] . '</div>'; echo '<div>' . $key['active_terms'][0]['name'] . '</div>'; }
Anonymous(Private) July 26, 2016 at 3:11 pm #52218Well, that breaks the code, the part where the echo should be doens’t show anymore. The rest doesn’t show neither.
<?php global $searchandfilter; $sf_current_query = $searchandfilter->get(15)->current_query()->get_array(); foreach($sf_current_query as $key) { echo '<div>' . $key['name'] . '</div>'; echo '<div>' . $key['active_terms'][0]['name'] . '</div>'; } ?>
-
AuthorPosts