Forums Forums Search & Filter Pro Using two category filters

Tagged: 

Viewing 10 posts - 1 through 10 (of 11 total)
  • Anonymous
    #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
    Albert

    Trevor
    #150753

    You 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
    #151158

    Hi 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 Schilling

    Trevor
    #151160

    CPT 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
    #151209

    Thanks 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
    #151213

    Ah. Those are the wrong ones. ACF makes 3 meta keys for each field, like this:

    #1 _location
    #2 field_5a16902ae5c07
    #3 location

    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
    #151270

    Awesome, 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 😉 Thanx

    Trevor
    #151282

    You can have as many fields as you want in each field group. It should work fine like that. Can this thread be closed for now?

    Anonymous
    #151284

    Yes, it can. I have another question concerning the php in the date of the filtered post. But I guess this should go in another threat.

    Trevor
    #151287

    Are you using the shortcode method for results? If you are, the template is editable:

    https://www.designsandcode.com/documentation/search-filter-pro/search-results/using-a-shortcode/#Customising_the_Results

    … 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:

    https://codex.wordpress.org/Function_Reference/get_the_date

Viewing 10 posts - 1 through 10 (of 11 total)