我一直在努力争取这个功能,我希望我有足够的敬意来提供赏金。非常感谢帮助。
// Advanced Search Check
function ct_search_form_check($name, $taxonomy_name = null) {
global $search_values;
if (!$taxonomy_name) {
$taxonomy_name = $name;
} ?>
<?php foreach( get_terms($taxonomy_name, 'hide_empty=0') as $t) : ?>
<?php if ($search_values[$name] == $t->slug) { $selected = 'checked="checked"'; } else { $selected = ''; } ?>
<div><input id="ct_<?php echo $name; ?>" name="ct_<?php echo $name; ?>" type="checkbox" style="margin-right:5px; margin-left:5px" <?php echo $selected; ?>value="<?php echo $t->slug; ?>"><?php echo $t->name; ?><span style="margin-left:10px"></span></input></div>
//recently added this part to replace duplicate taxonomy_name in url
<?php $data = array();
while (list($name, $t->slug) = each($arr)) {
$data[] = "$name";
}
echo implode($data); ?>
<?php endforeach; ?>
<?php
}
如何从
更改输出ct_zipcode =安培; ct_event_type =校友&安培; ct_ = anneverisy&安培; ct_setting =舞厅&安培; ct_ =栏&安培;地点搜索=真
到
ct_zipcode =安培; ct_event_type =校友%2canneverisy&安培; ct_setting =舞厅%2cbar&安培;地点搜索=真
答案 0 :(得分:0)
这很有用。希望它能帮助别人
function ct_search_form_check($name, $taxonomy_name = null) {
global $search_values;
if (!$taxonomy_name) {
$taxonomy_name = $name;
} ?>
<input type="hidden" value="" name="ct_<?php echo $name; ?>" />
<?php foreach( get_terms($taxonomy_name, 'hide_empty=0') as $t) : ?>
<?php if ($search_values[$name] == $t->slug) { $selected = 'checked="checked"'; } else { $selected = ''; } ?>
<div><input id="ct_<?php echo $name; ?>" name="ct_<?php echo $name; ?>" type="checkbox" style="margin-right:5px; margin-left:5px" <?php echo $selected; ?>value="<?php echo $t->slug; ?>"><?php echo $t->name; ?><span style="margin-left:10px"></span></input></div>
<?php
$data = array();
while (list($name, $t->slug) = each($arr)) {
$data[] = "$name";
}
echo implode($data);
if (!empty($_GET['ct_'])) {
$url = str_replace('&ct_=', '%2c', $_SERVER['QUERY_STRING']);
header("Location: ?$url");
} ?>
<?php endforeach; ?>
<?php
}