• Hi there, I would like to display the two optional flags instead of languages and then the drop down menu.
    Sorry, I am a newbie!!
    So e.g. you are on the spanish site, I’d like to see only the german and english flag to be able to choose from.
    I have found this:
    <!– outputs a flags list (without languages names) –>

      <?php pll_the_languages( array( ‘show_flags’ => 1,’show_names’ => 0 ) ); ?>

    Important: You have to output yourself the ul tags if you don’t use the dropdown option
    Also what does this mean: IMPORTANT: when using one or more of these function, you *must* check for its existence before using it, otherwise your site will badly break with a fatal error at next Polylang update (as WordPress deletes the plugin when updating it).
    Is this what I want and if yo, where and how do I implement this please? Because in the backend of the plugin, I can not see any settings. Thank you!!

    The page I need help with: [log in to see the link]

Viewing 11 replies - 1 through 11 (of 11 total)
  • Hi,
    This is interesting. In which file did you find the way to get the flags appearing? I’m desepratly looking for that.
    Thanks.
    Ivan

    Thread Starter moorsanna

    (@moorsanna)

    Hey @ivanbel ,
    I just sported everything out in the WP-backend in the plugins settings, you choose the language and the according flag.
    The only thing I changed, since I did not want the current language displayed was this:
    #site-navigation .current-lang {
    display: none;
    }
    In your case the issue for the flags not displaying might be this:
    “It is quite frequent that theme developpers forget that plugins can add images in menu items and thus create custom walkers which do not interpret the html code used by Polylang to display flags.”
    Not sure if this helps…as said, I really would like to display just the other two options in the menu….in case anyone has any ideas?? ??

    • This reply was modified 7 years, 2 months ago by moorsanna.

    Hello @Moorsana,
    Thank you for the css code.
    @all
    Don’t you think it would be possible to add a css code to force displaying the flags, like (I don’t know if that do exist.

    #site-navigation .current-flag{
    display: 1;
    }

    My current template is twenty seventeen, the basic wordpress that is included.

    Thread Starter moorsanna

    (@moorsanna)

    Cheers for the idea, the thing is, I do not want the menu item “languages”, but jut the two flag options displayed…. ??

    That’s exactly what I want too, but noone seems to be able to answer that question…

    anonymized-13603639

    (@anonymized-13603639)

    Guys, there is no clickable build in function to show only flags.
    The answer and code, postet by @moorsanna, is the right and only way to get this done.
    You need knowledge regarding WordPress, Child Theme, PHP, HTML and CSS to achieve this.
    A general code snippet will no help because each theme has different ways where to display flags and how to use CSS.

    @lachender_engel

    Thank you for your answer. So if you understand you right, we have to put this string :
    <?php pll_the_languages( array( ‘show_flags’ => 1,’show_names’ => 0 ) ); ?>

    But where? In which file?

    anonymized-13603639

    (@anonymized-13603639)

    @ivanbel Depens on where oyu want to display the flags.
    As I wrote, there is no general answer which works for everybody. It depens on the theme.
    If you want to show the flags in the header, you have to add this at the right place in header.php. If oyu want to show it in the footer, you need to edit footer.php.
    But, before you do this, you have to create a Child Theme.

    As I wrote, it is nothing out of the box which is working for everybody.

    Otherwise, when it’s working
    1- go to Appearance/Menu
    2- in your menu you should have “list of languages”. Open it.
    3- check “Display flags only”

    I think we can close this thread.

    Thread Starter moorsanna

    (@moorsanna)

    Hey @lachender_engel and @ivanbel,

    in my backend for some reason I do not have this option:
    1- go to Appearance/Menu
    2- in your menu you should have “list of languages”. Open it.
    3- check “Display flags only”

    Anyhow, I am working with a child theme of spacious, and would like to implement this:
    <?php pll_the_languages( array( ‘show_flags’ => 1,’show_names’ => 0 ) ); ?>
    The question is, I can not figure out how the languages dropdown link gets into my menu, there is no menu options in the plugin backend neither in the WP menu nor the theme menu.
    I am desperately trying to find the right php file where to put the above code, to only display the two flags without a dropdown link that states “languages”. Sorry for being a pain.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Help!Display flags only’ is closed to new replies.