Title: Toggle selection?
Last modified: August 1, 2017

---

# Toggle selection?

 *  [jacquid](https://wordpress.org/support/users/jacquid/)
 * (@jacquid)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/toggle-selection/)
 * Hi, is there a way to use this in the menu, where only one language option is
   displayed, and it toggles when clicked?
 * For instance, my site is English by default, and the only other language I am
   using is Spanish. I would like for it to say ESPAÑOL, but when it is clicked,
   for it to switch to ENGLISH, so only one language choice is shown? Right now 
   I have 2 menu links using the shortcode for each language, but would like for
   only one to be available at a time.
 * Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [Rob Myrick](https://wordpress.org/support/users/rm2773/)
 * (@rm2773)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/toggle-selection/#post-9370817)
 * 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
 *  Thread Starter [jacquid](https://wordpress.org/support/users/jacquid/)
 * (@jacquid)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/toggle-selection/#post-9378155)
 * I got this figured out- thanks!
 *  [parkersteelco](https://wordpress.org/support/users/parkersteelco/)
 * (@parkersteelco)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/toggle-selection/#post-9644919)
 * [@jacquid](https://wordpress.org/support/users/jacquid/) I am trying to accomplish
   this as well. Can you share what you were able to figure out?
 * Thanx!
 *  Thread Starter [jacquid](https://wordpress.org/support/users/jacquid/)
 * (@jacquid)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/toggle-selection/#post-9644997)
 * I ended up using the GTranslate plugin ([https://wordpress.org/plugins/gtranslate/](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>
       ```
   
 *  [parkersteelco](https://wordpress.org/support/users/parkersteelco/)
 * (@parkersteelco)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/toggle-selection/#post-9645641)
 * Awesome! Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Toggle selection?’ is closed to new replies.

 * ![](https://ps.w.org/google-language-translator/assets/icon-256x256.png?rev=3007649)
 * [Translate WordPress - Google Language Translator](https://wordpress.org/plugins/google-language-translator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/google-language-translator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/google-language-translator/)
 * [Active Topics](https://wordpress.org/support/plugin/google-language-translator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/google-language-translator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/google-language-translator/reviews/)

 * 5 replies
 * 3 participants
 * Last reply from: [parkersteelco](https://wordpress.org/support/users/parkersteelco/)
 * Last activity: [8 years, 5 months ago](https://wordpress.org/support/topic/toggle-selection/#post-9645641)
 * Status: not resolved