Hi,
sorry for delay, I saw your message just now…
Actually you can use get_locale because the plugin change current locale in according to current language…
Anyhow you can use:
CMLLanguage::get_current_locale()
You can find full API documentation in Ceceppa Multilingua -> Api page, if something isn’t clear let me know 🙂
Hallo could you please give one short example how to call the current language, maybe by id or by name.
I like to create a loop and use the language id as a condition, but until now, its always emtpy?
Thanks katasun
Hi,
to get info about current language you can use this method:
CMLLanguage::get_current_id(); //Return current language id
CMLLanguage::get_current_slug(); //Return current language slug
CMLLanguage::get_current_locale(); //Return current language locale
/* The function above will return a stdClass Object of current language: */
CMLLanguage::get_current();
I like to create a loop and use the language id as a condition, but until now, its always emtpy?
Which method return empty value?
Thanks a lot I copied this from your code which is working:
$current = cml_get_current_language();
if($current->cml_language_slug == ‘en’){
echo $slide[‘description’];
}
if I only want the id it could be done like this?
$current = cml_get_current_language();
if($current->cml_language_id == ‘2’){
echo $slide[‘description’];
}
Thanks katasun
Hi,
you can write:
if( $current->id == 2 )
or
if( CMLLanguage::get_current_id() == 2 )
it’s the same…
Cheers
Alessandro