Language Permalink / Custom Language Dropdown
-
Hello,
I created a custom Bootstrap language picker, because I did’t like the default dropdown and I couldn’t figure out how to place my SVG flag images. Only problem is that I cannot get the permalink working and stuck with a static one to the homepage?
<?php if (get_locale() == 'en_US') {?> <!--- EN --> <?php // echo get_locale(); ?> <div class="langchooser btn-group"> <button class="btn btn-default btn-sm dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <img src="<?php echo esc_url( get_template_directory_uri());?>/assets/img/english.svg" class="img-responsive" alt="English"> <span class="caret"></span> </button> <ul class="dropdown-menu"> <li><a href="<?php echo 'https://www.bla.com/nl' // dutch ?>"> <img src="<?php echo esc_url( get_template_directory_uri());?>/assets/img/dutch.svg" class="img-responsive" alt="Nederlands"></a></li> </ul> </div> <?php }else{ ?> <!--- NL --> <?php // echo get_locale(); ?> <div class="langchooser btn-group"> <button class="btn btn-default btn-sm dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <img src="<?php echo esc_url( get_template_directory_uri());?>/assets/img/dutch.svg" class="img-responsive" alt="Nederlands"> <span class="caret"></span> </button> <ul class="dropdown-menu"> <li><a href="<?php echo 'https://www.bla.com/' // english ?>"> <img src="<?php echo esc_url( get_template_directory_uri());?>/assets/img/english.svg" class="img-responsive" alt="English"></a></li> </ul> </div> <?php } ?>
- The topic ‘Language Permalink / Custom Language Dropdown’ is closed to new replies.