• Hello,
    I would like to know if it’s possible to switch postinpost query language in home page through xili language list ?
    I have seen that it works on single post but not on hp.
    The following code is what I used in hp:

    <?php
    if (the_curlang() == 'en_us' ) {
    echo do_shortcode('[xilipostinpost query="showposts=4&meta_key=wpb_post_views_count&orderby=meta_value_num&order=DESC&lang=en_us"]');
    } 
    
    else {
    
    echo do_shortcode('[xilipostinpost query="showposts=4&meta_key=wpb_post_views_count&orderby=meta_value_num&order=DESC&lang=de_de"]');
    }
    
    ?>

    These are the xili language panel options I have activated:

    Language of the home webpage : Software defined
    Modify home query: unchecked

    When I click on German language link, the website continues to display English content.

    Any idea ?

    Thank you again !

    https://www.ads-software.com/plugins/xili-language/

Viewing 1 replies (of 1 total)
  • Plugin Author Michel – xiligroup dev

    (@michelwppi)

    How xili-language works to define the language of the home page ?
    The language is defined just before the webpage is displayed, just after the results of the main loop query (will be presented) and just before the template (file) of theme is chosen.
    If settings are set to browser language, some calculations are done (to subselect the loop results or change static home page).
    In this case with xili-postinpost, the result list can be used in a widget or else where and based on the language determined before by the loop + settings. (a portal with multiple lists or queries in bars or div).
    ‘Software defined’ is reserved for developer with good knowledge in WP and XL…
    If you code echo a shortcode, it will be far better to use the xili_postinpost function itself with query defined with array as well explained in codex. Powerful with complex query.
    Some infos are here https://2015.extend.xiligroup.org/en/category/wp-tips-and-tricks/.

Viewing 1 replies (of 1 total)
  • The topic ‘Xili language – Home page language switch’ is closed to new replies.