Switch language if the one of visitor browser is not available

dev.xiligroup is being renovated Forums xili-language plugin Switch language if the one of visitor browser is not available

This topic contains 0 replies, has 3 voices, and was last updated by  xiligroup dev 9 years, 6 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • #2994


    are you able to write in php and create a small function ?



    Yes, I’ve tried to hook the function that sets the language through a custom function in my functions.php file but I had errors telling that I was not in OOP anymore (because of the « this « tag of the original function that I’ve copied).

    Basically I was looping through the available languages and if none was found then I returned « it_it » as the current one.

    Thanks for the help


    xiligroup dev

    as readable in code of plugin itself or in multilingual-functions.php in theme named twentyten-xili, you must replace $this by the global $xili_language created when class is instantiated.


    function my_function() {
    if ( class_exists('xili_language') ) {
    global $xili_language;

    if (

    for your specific case… give me a little time !



    thanks for your help, hoping to hear from you soon ;-)



    the key filter named ‘choice_of_browsing_language’ for this purpose is called in a function (at around line #1700 in plugin)… and when an external filter is available don’t execute the core function.

    function choice_of_browsing_language() {
    if ( has_filter('choice_of_browsing_language') ) return apply_filters('choice_of_browsing_language');

    so in your functions.php create your own filter by studying before the current function inside plugin code…

    function edo_choice_of_browsing_language() {
    /// edo rules
    return $lang_slug;
    add_filter ( 'choice_of_browsing_language', 'edo_choice_of_browsing_language' );



    thanks for your feedback. Just one thing: I have an error saying:

    Warning: Missing argument 2 for apply_filters(), called in /Users/Edoardo/Sites/laletterag.it/wp-content/plugins/xili-language/xili-language.php on line 1721 and defined in /Users/Edoardo/Sites/laletterag.it/wp-includes/plugin.php on line 134

    so I’ve checked around and it seems that apply_filters() has 2 variables and in xili_language.php there is only one. If I put a random variable $hello it works without showing the error.


    if ( has_filter(‘choice_of_browsing_language’) ) return apply_filters(‘choice_of_browsing_language’);


    if ( has_filter(‘choice_of_browsing_language’) ) return apply_filters(‘choice_of_browsing_language’, $hello);

    Is it me or there is a minor bug?


    xiligroup dev


    this warning occur on some server (php ?) need one arg by default… next version 2.3.1 will fixe this message.. by including a  ».

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

You must be logged in to reply to this topic.