Bug in multi language selector

Closed
LordCros - Hotel Booking WordPress Theme LordCros - Hotel Booking WordPress Theme June 22, 2020
Login to reply
massimiliano d'alicandro
3 weeks ago

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

massimiliano d'alicandro
1 month ago

That's good now. Thanks for your support.

Kelly R Support Agent
1 month 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
1 month 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>