Multilingual Header Media with Polylang
What’s the issue about?
My PhotoFrame theme uses WordPress’ built-in Header Media functionality to create a hero slideshow on the homepage of the website. You can see what it looks like here.
The user has to go to Appearance > Customize > Header Media and upload one or more images to be used in the header slideshow. This is what it looks like:
There are no language controls on this screen, so you would expect that this image should be easily accessible by any language created via Polylang. But it is not so (yet).
I spent about half an hour debugging my theme code, trying to understand why this feature doesn’t work on secondary languages. I expected it to be a code issue. It is not.
To make your header media available in other languages too, you have to manually translate these images. Here’s how to do it (screenshots below):
- Go to Dashboard > Media > Library.
- Make sure to switch to List mode instead of Grid mode.
- Find your Current Header Media image in the list.
- Click the + (plus) sign under the language flags that it is available for.
- On the Edit Media page, make sure you have the correct language and simply click Update.
And you’re done! Now your header media should be displayed in your secondary languages too.
Considering that Polylang is currently installed on 400,000+ websites, I hope that this post will help others too.