A multilingual custom header image

Some themes (Twenty Twelve, Responsive…) use the builtin WordPress custom header image. That’s a nice feature, but what if you include text in this header image? You will need one image per language! It is very easy to obtain thanks to the wpml-config.xml file.

Step 1: create a directory ‘polylang’ in ‘wp-content’ (this is a place where you can store Polylang cutomizations which will not be overwritten when updating Polylang).

Step 2: Copy paste the following code in a file called ‘wpml-config.xml’ that you upload in your ‘wp-content/polylang’ directory:

    <key name='theme_mods_twentytwelve'>
      <key name='header_image' />

You need to replace twentytwelve by the name of your theme (in fact the name of your theme directory)

Step 3: Set an header image in ‘Appearance -> Header’

Step 4: Go to Settings -> Languages -> Strings translations. You can now choose one header image url per language!

20 thoughts on “A multilingual custom header image

  1. Marc Trayter

    I like this post very much but… I tried it and it didn’t work. My theme is Response, and the images are not in the header but they can be used like header. Please, how I can solve it?

    1. Frédéric Post author

      No. It can’t work because the Response theme does not use the builtin WordPress custom header. However, this may work:

          <key name='cyberchimps_options'>
            <key name='custom_logo_uploader' />
      1. Marc Trayter

        Thanks for your help and interest, it is appreciated. Unfortunately it did’nt work but I feel we are close.

        In the string translation, it appears something knew but I don’t understand how it works. The new string to translate it’s called http://www.advocatgirona.cat/wp-content/themes/response/cyberchimps/lib/images/achimps.png. This archive (achimps.png) it is not my slider, it is a logo from the theme.
        Do I have to change the original string? (How to do this?)
        Do I should create a new directory for each language with the appropriate slider? (How to do this ?)
        Anyway, when I create the slider, I could select language for each image but the problem is that wordpress only saves one language option. Maybe this could be solved?

        Thanks in advance.

      2. Kuba

        Hi! I tried this approach with nemesis theme – nanibystudio.pl, but no new string appeard for translation. I only need to translate log picture which includes some text that should be translated. The logo is loaded by the theme. Can you help me to solve this problem?

  2. Neev

    Hello there,
    I’m using a child theme, and I would like to change header image with different languages, everthing works fine with main theme (Twelve Twelve) but with my child theme the header does not changes when I change the language.
    My child theme is called test1.
    Thanks in advance

  3. P

    I don’t get this part of the solution:

    Step 4: Go to Settings -> Languages -> Strings translations. You can now choose one header image url per language!

    There is no way to add anything new in here

    1. Frédéric Post author

      Unfortunately, this theme dos not use the WordPress builtin feature. Here’s the wpml-config.xml file that you can use:

          <key name='vantage_theme_settings'>
            <key name='logo_image' />

      This theme does not store image urls but a number assigned to your picture in your media library. You can see this number in the url when you edit the media, something like /wp-admin/post.php?post=60&action=edit. Here the media number is 60.

  4. Madmax

    Thanks for this post. I’m using twenteethirteen theme and it work weel.
    But it only work with one image on header. It doesn’t work for random-uploded-image. Do you have any solution for ?

  5. fabian

    Hi, i am using the cherry framework and a custom child theme in my wp installation .
    Do you have a solution for this combination?
    I tried as adviced but also Step 4 is not possible to fulfill.

  6. Ramon

    I’m using polylang plugin and I have visited this post to solve the change language image header. It works correctly with your code, but only in the home page for each language. When I enter in another section of the website (both languages) the image header disappears!
    Can I resolve this problem? Maybe it’s because in the language home page appears
    “www.xxx.com/?lang=es” and when I go to another page section the “?lang=es” disapears too.
    I will be so greatful if you can help me!

  7. Step

    Hello, I’m using Polylang with Themeco X THEME, and I’d like to be able to switch header’s logo between different languages. I tried with xml technique, with no success.
    Any further clue?

    Thanks and regards,

Comments are closed.