• Hi,

    Hope someone could help me quickly..
    I followed the instructions on this page https://polylang.pro/doc/can-i-use-my-own-flags-for-the-language-switcher/
    PRobably did miss something because as you can see on my website, it’s like a missing file.
    I uploaded my files fr_FR.svg and en_GB.svg here : /www/wp-content/polylang
    and created a mu plugin named polylang-svg.php, here : /www/wp-content/mu-plugins.

    In there, i put this code

    <?php

    add_filter( ‘pll_custom_flag’, ‘pll_custom_flag’, 10, 2 );

    function pll_custom_flag( $flag, $code ) {
    $flag[‘url’] = “https://suzzikafe.fr/wp-content/polylang/{$code}.svg”;
    $flag[‘width’] = 30;
    $flag[‘height’] = 30;
    return $flag;
    }

    ?>

    And i refresh the URL modifications into the polylang settings .
    It’s broken because i can see the “French” label just next to a missing file logotype.
    Could someone have the solution ?
    Thanks a lot,
    Romain

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Chouby

    (@chouby)

    Hello,

    I can’t check on your site as you switched to PNG files. But it looks to me that there is misunderstanding of what $code is. This is the flag code, so values will be ‘fr’ an ‘gb’, not ‘fr_FR’ and ‘en_GB’ as it looks like you named your files.

    Thread Starter romainfavraud

    (@romainfavraud)

    Hi Chouby,
    Thanks for your answer that i didn’t see!

    First you can’t see because i had to turn into PNG files becsuse we launched the site and can’t have an error of displaying

    Second, I tried with your advice. I tried with this code (the same) and more (with or without /www/, with or without /wordpress/…

    <?php

    add_filter( ‘pll_custom_flag’, ‘pll_custom_flag’, 10, 2 );

    function pll_custom_flag( $flag, $code ) {
    $flag[‘url’] = “https://suzzikafe.fr/www/wp-content/polylang/{$code}.svg”;
    $flag[‘width’] = 32;
    $flag[‘height’] = 22;
    return $flag;
    }

    ?>

    I renamed my two file flags just “fr.svg”, “en.svg”… but nothing worked. I put “fr_FR” last time because the png flag files base’s name is fr_FR.png so, i believed it was the same with SVG. Have you some idea ?

    To refresh, maybe i did wrong before : i created a “mu-plugins” folder into wp-content, so the path i can copy on FileZilla is /www/wp-content/mu-plugins/…

    What’s wrong with my setting ?
    Thanks for your help

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[URGENT] Problem with SVG flag’ is closed to new replies.