Multilingual Header Media with Polylang

Today I received an interesting support request regarding the Polylang WordPress Plugin and my free PhotoFrame WordPress Theme.

What’s the issue?

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.

I discovered that the core WordPress get_uploaded_header_images() function will not fetch header images for the primary language when secondary languages don’t have any header images.

The Solution

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):

  1. Go to Dashboard > Media > Library.
  2. Make sure to switch to List mode instead of Grid mode.
  3. Find your Current Header Media image in the list.
  4. Click the + (plus) sign under the language flags that it is available for.
  5. 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.

Previous Post

60 Beautiful and Unique University Websites Powered by WordPress

Next Post

30 Unique Museum Websites Powered by WordPress

Be the first to comment

Leave a Reply or Comment

Your email address will not be published. Required fields are marked *