Bug in multi language selector

Closed
LordCros - Hotel Booking WordPress Theme LordCros - Hotel Booking WordPress Theme June 22, 2020
Login to reply
Jones James
1 year ago

Hello! I'm quite sure I've been to this website before cookie clicker but I'm not entirely sure. earlier, but after reading through some of the other postings, I understood that it was something I had never experienced before. Regardless, I am really delighted I came across it, and I have book-marked it and will be coming back frequently!

massimiliano d'alicandro
4 years ago

Hi guys, you can close this ticket. Thank you.

massimiliano d'alicandro
4 years ago

That's good now. Thanks for your support.

Kelly R Support Agent
4 years ago

Hello,

Please replace with following code.

<div class="wcml_language_switcher language-picker">

     <?php
      $activeLanguageHtml = '';
      $languageListHtml = '';
      foreach ( $languages as $l ) {

       if ( $l['active'] ) {
        $activeLanguageHtml = '<a href="javascript: void(0)" class="wcml_selected_language">' . esc_html($l['language_code']) . '</a>';
       } else {
        $languageListHtml .= '<li><a href="' . esc_url( $l['url'] ) . '">' . esc_html( $l['language_code'] ) . '</a></li>';
       }
      }
     ?>

     <?php echo $activeLanguageHtml; ?>
     <ul>
      <?php echo $languageListHtml; ?>
     </ul>
    </div>

Best regards,

massimiliano d'alicandro
4 years ago

Hi guys, I think there is a bug in lordcros_multi_language_switcher function in templates/header/element-functions.php. The bug is in some case the order of html tags is wrong and it causes errors on displaying the language selector combobox. Here is the wrong code, please fix it and give me a feedback. Thank you for your attention.

    <div class="wcml_language_switcher language-picker">

     <?php

      foreach ( $languages as $l ) {

       if ( $l['active'] ) {

        ?>

        <a href="javascript: void(0)" class="wcml_selected_language"><?php echo esc_html($l['language_code']); ?></a>

        <ul>

        <?php

       } else {

        echo '<li><a href="' . esc_url( $l['url'] ) . '">' . esc_html( $l['language_code'] ) . '</a></li>';

       }

      }

     ?>

     </ul>

    </div>