• Hi !

    I’m running a 2 languages site (EN & FR), based on WP-MSLS multi-site installation.
    I’ve setup a specific search function on posts categories in FR, that search results on specific category (based on the ID). As the IDs of EN posts are different, the function doesn’t work.
    How can I make it work ? i.e. : “if language is FR, then search on category ID #x, and if language is EN, then search on category ID#y”

    Thanks for your help.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Dennis Ploetner

    (@realloc)

    MSLS stores even for categories the related ID for their counterparts. I’m not sure what you want to archive but if you need just that ID there should be no problem.

    Thread Starter olivevm

    (@olivevm)

    Hi Dennis, and thank you for your reply. I think I didn’t explain my subject correctly.

    With WPML, we have the following code to translate a category with its ID and current language :

    $cat_id=14; //cat id in english version, default site language
    $translated_cat_id = icl_object_id($cat_id, ‘category’, false, ICL_LANGUAGE_CODE);
    $category = get_category($translated_cat_id);

    In this particular code, if ICL_LANGUAGE_CODE = ‘en’, the $translated_cat_id will always remain 14, otherwise, it’ll be replaced by the ID of the translated category.

    I want the equivalent of this function with Multilinguage switcher.

    Or have kind of :
    if (ICL_LANGUAGE_CODE==’en’) $cat_id=14;
    else $cat_id=22;
    and I want to know the equivalent function of ICL_LANGUAGE_CODE

    Thank you

    Plugin Author Dennis Ploetner

    (@realloc)

    Hi,

    sorry for the late response. Did you check out the Multisite Language Switcher Website that I mentioned in the readme.txt -> “Installation”?

    You might find the last paragraph in the FAQs very useful.

    Cheers,
    Dennis

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Search on categories ID’ is closed to new replies.