By selecting search item and click on find tour i want to search particular categories but in print_r($_GET) i received on only one category id如何在WordPress中獲取所有的URL變量數據?
I want all four category id in $_GET variable to search for categories
我使用此代碼爲下拉列表: -
$category = array(
'show_option_all' => 'Select Tour',
'orderby' => 'name',
'show_count' => 0,
'taxonomy' => 'tour_category',
);
$tour_category = wp_dropdown_categories($category);
$line = array(
'show_option_all' => 'Select cruise Line',
'orderby' => 'name',
'echo' => 1,
'taxonomy' => 'genre',
);
$cruise_line = wp_dropdown_categories($line);
$month = array(
'show_option_all' => 'Select Month',
'orderby' => 'name',
'echo' => 1,
'taxonomy' => 'date_month',
);
$date_month = wp_dropdown_categories($month);
$length = array(
'show_option_all' => 'Select Trip Length',
'orderby' => 'name',
'echo' => 1,
'taxonomy' => 'writer',
);
$trip_length = wp_dropdown_categories($length);
其實我想使基於這四個類別搜索。 我以前的代號是這樣的: -
$text_field_label = _x('Search Tour', 'placeholder', 'adventure-tours');
printf(
'<div class="%s">%s' .
'<div class="form-block__item form-block__field-width-icon">' .
'<input type="text" %svalue="%s" name="s"><i class="td-search-1"></i>' .
'</div>' .
'</div>',
esc_attr('col-sm-' . $search_field_cells),
$is_show_label ? sprintf('<div class="form-block__item-label 1">%s</div>', esc_html($text_field_label)) : '',
$is_show_label ? '' : sprintf('placeholder="%s" ', esc_attr($text_field_label)),
get_search_query()
);
我把它轉換在下拉菜單有四個不同的類別。
在您的URL中使用cat1,cat2,cat3和cat4 –