查询多个分类组 slugs [英] Query multiple taxonomies group slugs
问题描述
我有一个用于搜索查询的复选框功能.我的问题是搜索时创建的网址.
?ct_zipcode=&ct_event_type=birthday&ct_event_type=photovideo-shoot&Venue-search=true
当我检查了多个 taxonomy_names 时,我只会得到搜索结果中的最后一个.
我需要像这样重写我的网址:
?ct_zipcode=&ct_event_type=birthday%2Cphotovideo-shoot&Venue-search=true
有没有一种简单的方法可以通过重写来更改我的网址?我尝试了一点 str_replace
/preg_replace
,但没有运气.
将输入字段的名称更改为 ct_event_type[]
,您将获得检查值作为数组.
HTML 部分应如下所示:
<label for="ct_<?php echo $name; ?>">//for 应该和 checkbox id 一样<输入id="ct_"name="ct_"类型=复选框"style="margin-right:5px; margin-left:5px"value="<?php echo $t->slug; ?>"/>//<-- 关闭输入<?php echo $t->name;?>标签>
注意label
的使用.
I have a checkbox function that I'm using for my search query. My problem is the url created when I search.
?ct_zipcode=&ct_event_type=birthday&ct_event_type=photovideo-shoot&Venue-search=true
When I have multiple taxonomy_names checked I only get the last slug in my search results.
I need my url to be rewritten like:
?ct_zipcode=&ct_event_type=birthday%2Cphotovideo-shoot&Venue-search=true
Is there an easy way to change my url with rewrite? I've tried a little str_replace
/ preg_replace
with no luck.
Change the name of the input field to ct_event_type[]
and you'll get the checked values as an array.
The HTML part should look like this:
<div>
<label for="ct_<?php echo $name; ?>"> // for should be the same as checkbox id
<input
id="ct_<?php echo $name; ?>"
name="ct_<?php echo $name; ?>"
type="checkbox"
style="margin-right:5px; margin-left:5px"
value="<?php echo $t->slug; ?>" /> // <-- closing input
<?php echo $t->name; ?>
</label>
</div>
Note the use of label
.
这篇关于查询多个分类组 slugs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!