Language Switch Function

You are now only testing for the theme location not to be empty. This means that every non empty menu location will see the language button attached.

So, in stead of testing for emptyness you should be testing for a specific location. The name of that location depends on your theme, but suppose it’s called ‘primary-menu’ you would have:

if (function_exists('icl_get_languages') && ($args->theme_location == 'primary-menu'))