Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter helloimrob

    (@helloimrob)

    thanks a lot Chouby :)!

    Thread Starter helloimrob

    (@helloimrob)

    Hi! Thanks a lot for the fast answer. Added the code. Now no error anymore, but it still doesnt work :/

    see http://shoutkey.com/sanctuary

    Thread Starter helloimrob

    (@helloimrob)

    Hi!
    Thanks for the fast answer and link, didnt read that before.

    Could you tell me/us which code I have to use to get the dropdown working? Or is this too complicated?
    Im new with PHP, so I just included everything regarding your in-code comments:

    foreach ($polylang->model->get_languages_list() as $language) {
    				$url = $force_home || ($url = $polylang->links->get_translation_url($language)) == null ? $polylang->links->get_home_url($language) : $url;
    				$urls[] = '"'.esc_js($language->slug).'":"'.esc_url($url).'"';
    			}
    
    			$urls = implode(',', $urls);
    
    			$js = "
    				<script type='text/javascript'>
    					//<![CDATA[
    					var urls = {{$urls}};
    					var d = document.getElementById('lang_choice');
    					d.onchange = function() {
    						for (var i in urls) {
    							if (this.value == i)
    								location.href = urls[i];
    						}
    					}
    					//]]>
    				</script>";
    
    			echo $js;

    but this (maybe obviously) didn’t worked.

    Thanks!

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