Forums › Forums › Search & Filter Pro › Using two category filters
Tagged: filters
- This topic has 10 replies, 2 voices, and was last updated 7 years, 4 months ago by
Anonymous.
-
Anonymous(Private) January 5, 2018 at 3:41 pm #150732
Hello Searchandfilter-team,
I just purchased your pro plugin today but found a problem with the filtering.
I want to filter posts with two category filters (both include different category ids). But apparently the plugin isn’t able to add up two filters of the same kind?
It’s obvious in the url. It jumps from one filter to the other (Like this : ?_sf_category=one –> ?_sf_category=two ) instead of adding up both (Like this: ?_sf_category=one&?_sf_category=two ).Is there a way to solve this? Thank you very much in advance.
Kind regards
AlbertTrevor(Private) January 5, 2018 at 5:27 pm #150753You can use a particular Taxonomy (or Category/Tags, each Taxonomy and each Custom Field) only once in the form. You would need to make additional taxonomies. This post tries to explain this a bit better (you can use a plugin to switch category terms from category to any new taxonomy that you make, so it is not so hard to do). It is a really awful preachy lecture I wrote:
https://support.searchandfilter.com/forums/topic/multiple-categories-combination/#post-55166
Sorry about the tone, but the message is right and it links to good plugins (except taxonomy switcher I think). If I missed anything (I probably did, my apologies), follow up and nudge me.
Anonymous(Private) January 8, 2018 at 6:02 pm #151158Hi Trevor,
thank your for your quick response and the link to the detailed description.
I don’t want to try new post types since my website already runs with the regular posts from wordpress. But I integrated the ACF and added two fields to specify my posts. Everything works fine so far.
Now I added those two fields in my search form. But when I use the search form on my website, it doesn’t find any posts (although it should find at least two). The auto count also indicates that there are no posts at all.
Strange. I rebuild the cache and refreshed the general wordpress cache but nothing worked.
I also used the following options in “Search in the following post types:”: “posts” and “field groups” (which comes from ACF I guess). So, everything should be fine…
Do you have an idea where the problem might be?
Thank you a lot for your help in advance!
Kind regards
Albert SchillingTrevor(Private) January 8, 2018 at 6:06 pm #151160CPT UI doesn’t just add new Post Types. It also lets you add taxonomies to existing Posts and pages.
Custom Fields in that list is different, so no, you would not need to tick that.
What are the keynames for the fields? If they start with an underscore, they are the wrong ones. Look for ones without the underscore.
Anonymous(Private) January 8, 2018 at 7:53 pm #151209Thanks for the quick response.
The fields are named “field_xxxx” (xxxx = some number) and I find them inside “Post Meta”.
I get all the right options that I defined. But somehow the posts are not included as search results although, as I said, at least two posts are assigned to the new custom fields…Trevor(Private) January 8, 2018 at 7:57 pm #151213Ah. Those are the wrong ones. ACF makes 3 meta keys for each field, like this:
#1
_location
#2field_5a16902ae5c07
#3location
You might have used key #2 in each case, but you need to use key #3, without the underscore at the start of the key name.
Anonymous(Private) January 8, 2018 at 9:02 pm #151270Awesome, works like a charm now. Apparently, two fields shouldn’t be in one AC-Field-group. It worked after I separated them. Can this be true?
Nevertheless, “search and filter” is a great plugin with an even greater support.
Thank you very much. I’m very happy now, and my boss will be, too 😉 ThanxTrevor(Private) January 8, 2018 at 9:42 pm #151287Are you using the shortcode method for results? If you are, the template is editable:
… and there are 2 WordPress date functions. One shows it once and then omits it from subsequent post of the same date (the one we use), one puts it on all. all you need do is witch between them:
-
AuthorPosts