Sorry if this has been asked before but had no luck finding an answer so far on the forums, so here I go!
I made a list that shows all the languages which works perfectly. My question now is, how do I exclude the (user's) language that's currently active from the list?
For example, I'm viewing the English site, how do I exclude English from the list...
Dutch
English
German
... so it only shows...
Dutch
German
... and when viewing the Dutch site excluding Dutch, when viewing the German site excluding German.. etc..
This is my code:
<?php
foreach($languages as $language) {
if(!$page->viewable($language)) continue; // check if page not published for this language
$url = wire('page')->localUrl($language);
$title = $language->getUnformatted('title')->getLanguagevalue($language->id);
$name = $language->get('language_name');
$location = $config->urls->templates;
echo "<li>$title</a></li>";
}
?>
Just started with Processwire so forgive me for asking a stupid question!
Thanks in advance!