Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro WPML + Search

Viewing 6 posts - 1 through 6 (of 6 total)
  • Damien ROCHE
    #19685

    Hi guys,
    I am having problems with a specific case.
    I have a website with 2 language (EN + FR)
    I have a custom post type, with a custom taxonomy translated for each language.
    I have set up a search & filter form for each language…

    … but I would like to display posts from EN & FR language when users click on a taxonomy radio button.
    For example, if I have a category call “chat” in FR with a slug equals to “chat” and the equivalent calls “cat” for EN with a slug equals to “cat”,
    if a user click on “Chat” input, both of posts will be displayed.
    I think that the request ajax uses the value from input.
    There is a way to set up multiple value (chat|cat) in each input in orders to display posts with the two taxonomies.

    Best Regards
    Damien

    Trisha Miller
    #19691

    Hi Damien,

    I hope you don’t mind my asking, but why would you want to do that? I know there are a lot of multi-lingual persons, sadly I am not one (well I do speak enough French and Spanish to get by while traveling, but not nearly enough to have a meaningful conversation)….BUT if I am searching for something on a website, I definitely do NOT want to see results in a language I don’t speak (well)…given the option, I would always choose to filter *out* non-English results.

    So I’m just curious, why do you want to mix results between languages?

    Damien ROCHE
    #19711

    Hi Trisha,
    I understand.
    I have to do this in order to create contest of idea,
    the website is in french and in english,
    but all ideas have to be written in english while the taxonomy are displayed in both languages.

    Ross Moderator
    #19732

    Hi Damien

    Unfortunately S&F cannot include multiple languages in a single search.

    The way S&F works is to let WPML take care of the language heavy lifting, so usually the search results will be of the language of the current page – or the lang of the page the shortcode is embedded.

    When we are looking at the search form itself, it is not possible to include taxonomies from other languages.

    There is one potential hack I can think of, but it would be a lot of work and trial and error, is to use pre_get_posts to modify your results, please see this post for an example of how to use pre_get_posts with Search & Filter:

    https://support.searchandfilter.com/forums/topic/filtering-by-meta/#post-12908

    Thanks

    Damien ROCHE
    #19747

    Thanks Ross,
    I found a trick…
    Before insert the shortcode in put this

    <?php
    global $sitepress;
    $sitepress->switch_lang('en');
    ?>

    …and after

    <php $sitepress->switch_lang('fr'); ?>

    Ross Moderator
    #19799

    Fantastic, I can’t for the life of me think of how or why that works, but glad it does!

Viewing 6 posts - 1 through 6 (of 6 total)

The forum ‘Search & Filter Pro’ is closed to new topics and replies.