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

    (@chouby)

    Hello,

    You can use the filter pll_get_flag. You’ll receive the complete img tag, so you can easily modify it to remove or add anything you want. See https://polylang.pro/doc/filter-reference/#pll_get_flag

    Thread Starter 4090

    (@4090-1)

    Thanks for that.

    However, I am not sure where to add the code. It says not to use the theme functions.php which is where I normally would add code and I do not have any idea about adding a plugin or mu-plugin.

    Do I need to add a new plugin or mu-plugin and if so how? or can I add it somewhere else? How? Where?

    Thanks.

    Plugin Author Chouby

    (@chouby)

    Yes. A mu-plugin is perfect for this case.

    It’s as simple as using a functions.php Create the folder mu-plugins in wp-content. Add a file, let say flags.php in this folder. Add your code in this file. WordPress will automatically execute your code.

    Thread Starter 4090

    (@4090-1)

    Thank you.

    However, I have created the mu-plugins folder in wp-content and created the flags.php in the folder.

    I have added the following code but in adds to the section before the DOCTYPE statement and does not change the actual code.

    <php?
    
    add_filter( 'pll_custom_flag', 'pll_custom_flag', 10, 2 );
    
    function pll_custom_flag( $flag, $code ) {
    $flag['url'] = content_url( "/polylang/{$code}.svg" );
    $flag['width'] = '';
    $flag['height'] = '';
    $flag['src'] = '';
    return $flag;
    }
    
    ?>

    Can someone please tell me what I am doing wrong?

    Thread Starter 4090

    (@4090-1)

    Have managed to get it to not show at the beginning but does not work.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.