• Resolved DaisyDesign

    (@daisydesign)


    Hello!
    I added the language switcher in the header and I customized it.
    I’m trying to highlight the current language but I noticed that only one language is wrapped with <li class="lang-item... tag. The other one is just tagged as <a hreflang ="en-GB".... So, when I add .current-lang a {my style} in my CSS, it only works with the language <li> tagged.
    How can I add the <li> tag to the other language?
    To show the switcher in the header I added this in my functions.php:

    function polylanguage_shortcode() {
    pll_the_languages( array( 'show_names' => 1 ) );
    }
    add_shortcode( ‘polylanguage’, ‘polylanguage_shortcode’ );

    and this in my header.php:

    <div class="polylanguage"<?php echo polylanguage_shortcode(); ?>
    	</div>

    Thank you so much in advance.
    Claudia

    • This topic was modified 6 years, 5 months ago by DaisyDesign.
    • This topic was modified 6 years, 5 months ago by DaisyDesign.
    • This topic was modified 6 years, 5 months ago by DaisyDesign.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter DaisyDesign

    (@daisydesign)

    So sorry, I did a very stupid mistake, I didn’t put the <ul> tag here:

    <div class="polylanguage"<?php echo polylanguage_shortcode(); ?>
    	</div>

    So, just to be helpful to someone else here the right code to put in the header.php:

    <div class="polylanguage"<ul><?php echo polylanguage_shortcode(); ?></ul>
    	</div>

    Sorry again.
    Claudia

    <?php if ( function_exists( 'pll_the_languages' ) ) : ?>
       <div class="languages">
          <ul class="lang-menu">
             <?php pll_the_languages(); ?>
          </ul>
       </div>
    <?php endif; ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘li class=”lang-item” only in one language’ is closed to new replies.