Skip to content

Commit

Permalink
feature($language) add language switcher
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel217D committed Jun 18, 2018
1 parent dcdeafa commit da8f0d8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion assets/styles/components/_language.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}
&_active {
color: $white;

cursor: pointer;
&:hover {
color: $gray-text;
}
Expand Down
8 changes: 8 additions & 0 deletions templates/lang.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php if(ICL_LANGUAGE_CODE === 'ru'):
$wpml_permalink = apply_filters( 'wpml_permalink', get_the_permalink() , 'est' );?>

<a href="<?= $wpml_permalink?>" class="lang-item lang-item_est lang-item_active"> est </a> <span class="lang-item lang-item_slash">/</span> <span class="lang-item lang-item_ru"> ru </span>
<?php else:
$wpml_permalink = apply_filters( 'wpml_permalink', get_the_permalink() , 'ru' );?>
<span class="lang-item lang-item_est "> est </span> <span class="lang-item lang-item_slash">/</span> <a href="<?= $wpml_permalink?>" class="lang-item lang-item_ru lang-item_active"> ru </a>
<?php endif; ?>
2 changes: 1 addition & 1 deletion templates/navBar-top.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="container">
<div class="row">
<div class="col-3 lang">
<span class="lang-item lang-item_est lang-item_active"> est </span> <span class="lang-item lang-item_slash">/</span> <span class="lang-item lang-item_ru"> ru </span>
<?php get_template_part('templates/lang') ?>
</div>
<div class="col-9 search">
<?php get_template_part('templates/search'); ?>
Expand Down
2 changes: 1 addition & 1 deletion templates/navBar.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<?php get_template_part('templates/search'); ?>
</div>
<div class="col-2 lang">
<a href="<?= home_url('/'); ?>" class="lang-item lang-item_est lang-item_active"> est </a> <span>/</span> <a href="<?= home_url('/'); ?>" class="lang-item lang-item_ru"> ru </a>
<?php get_template_part('templates/lang') ?>
</div>
</div>
</div>

0 comments on commit da8f0d8

Please sign in to comment.