0

I need different flag for languages.

It is possible to use your own images as flags. You have to use PNG or JPG files and name them with the WordPress locale. For example, en_GB.png. Then upload this file in the /wp-content/polylang/ directory (create the directory if it does not exist). Don’t use the /polylang/flags/ directory as your file would be removed when automatically updating the plugin.

Once the custom flag is uploaded, go in Languages > Settings > URL modifications module then click on save changes. Note that your custom flags are not used on admin side.

I did all of this but the language switcher have the same flags... I don't see how the plugin would recognize that if I place an en_GB.png file in its directory (Not the flags folder). Feels like they miss something important, how to assign the images to certain language...

Community
  • 1
  • 1
mojito000
  • 55
  • 1
  • 5
  • As the instructions say, you have to use the actual WP locale, in example on my installation I have en_US end others, but not en_GB, thus a flag named en_GB wouldn't be found, try to rename it in en_US.png to see if it works. – Luigi Caradonna Dec 25 '19 at 09:32

3 Answers3

2

I modify flags, with CSS using title attribute, example:

img[title="English"] {
    width: 50px !important;
    height: 30px !important;
}
Tyler2P
  • 2,324
  • 26
  • 22
  • 31
PieLeo
  • 21
  • 3
  • 1
    This is the correct answer, just bear in mind to inspect the img before adding the CSS code. For my situation it was alt not title. – ehab Dec 27 '21 at 08:55
0

You have to go ssh/ftp (or any other way) to add a folder under /wp-content. Your structure will look like:

> uploads
> themes
> polylang (this is your new folder)
> plugins
> languages
> index.php

Then create a PNG (preferably) or JPEG image for your flag (16x16px dimensions are good enough) and name it accordingly. For example for English you have to name the file as en_US.png (you can find the codes inside your plugin for each language). Upload your image under /wp-content/polylang directory and go to your WordPress administration panel under Languages > Settings > URL modifications (just open this and hit save). Refresh your browser and get your results!

George Ts.
  • 91
  • 1
  • 4
-1

Yes. You can use PNG, JPG or even SVG files and name them with the WordPress locale. For example, en_US.png.

Upload these files in the /wp-content/polylang/ directory.

Note: You have to create the directory yourself. Don’t use the /polylang/flags/ directory as your files would be removed when automatically updating the plugin. Alternatively, it’s possible to store the files in the /polylang/ subdirectory of the theme or the child theme.

Once the custom flags are uploaded, go to Languages > Settings. Click on the “URL modifications” settings and then on Save Changes.

chiku
  • 60
  • 6
  • 1
    Did you just copy the official polylang answer that the original author also quoted? sorry but I can't see how this answers the question - if you got it to work, please explain the steps – hreimer May 09 '21 at 09:54