Hi jacquid, can you please contact me here?
info @ wp-studio dot net
This would be a very small paid project. I don’t like charging but it’s my time involved. Let me know if you need my help.
Thanks, Rob
I got this figured out- thanks!
@jacquid I am trying to accomplish this as well. Can you share what you were able to figure out?
Thanx!
I ended up using the GTranslate plugin (https://wordpress.org/plugins/gtranslate/) because Google Language Translator had issues with functionality on tablet and mobile devices.
However, my solution carried over, using CSS and js to target classes, and locale storage to set the user’s language and display the appropriate link.
<script>
(function($) {
var lang = localStorage.getItem('currentlang');
$('.menu-item-gtranslate').eq(0).click(function() {
localStorage.setItem('currentlang','eng');
$('.menu-item-gtranslate').eq(1).css('display', 'inline-block');
$('.menu-item-gtranslate').eq(0).css('display', 'none');
});
$('.glink').eq(2).click(function() {
localStorage.setItem('currentlang','eng');
$(this).next().css('display', 'block');
$(this).css('display', 'none');
//console.log(lang);
});
$('.menu-item-gtranslate').eq(1).click(function() {
localStorage.setItem('currentlang','spn');
$('.menu-item-gtranslate').eq(0).css('display', 'inline-block');
$('.menu-item-gtranslate').eq(1).css('display', 'none');
});
$('.glink').eq(3).click(function() {
localStorage.setItem('currentlang','spn');
$(this).prev().css('display', 'block');
$(this).css('display', 'none');
//console.log(lang);
});
$(window).load(function() {
if (lang=='eng'){
$('.menu-item-gtranslate').eq(1).css('display', 'inline-block');
}else{
$('.menu-item-gtranslate').eq(0).css('display', 'inline-block');
};
});
})(jQuery);
</script>