[resolved] I want to use custom images instead of language name in language switcher (4 posts)

  1. Tobias Kirsch
    Posted 2 years ago #

    Hi all,

    I really appreciate this module but now I face a problem which I do not get solved as I am not really a programmer - at least I fail understanding how the filters work.

    I found out so far that I can use

    add_filter('pll_the_languages', 'custom_language_switcher', 10, 2);

    in my custom plugin to change the output of the language switcher. But that's all :-) HOW I exactly achieve what I want keeps being a secret to me. What I want to achieve: I have activated English and German. The language switcher should show up a custom image for each language (important: not as a background image but as a HTML inserted image with <img>). So when German is the language to switch to it shows a custom button and when English is the language it shows another custom button - no language name, slug or flag.

    Could please somebody help me??



  2. Chouby
    Plugin Author

    Posted 2 years ago #

    You don't need to program... If I well understood, you just need a custom flag which can be the picture you want.
    In your language switcher option, choose to display flags and not names. Then create a directory 'wp-content/polylang' and upload your pictures (png or jpg) that you should name with WordPress locale (for example en_US.png or de_DE.jpg).

  3. Tobias Kirsch
    Posted 2 years ago #

    Great, thank you... so easy :)

  4. hilmon
    Posted 2 years ago #

    Wow ... that really was easy :-) thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Polylang
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic