I'm tryng to make my shortcode multilanguage but this code is not working:
add_shortcode('periodo_affitti', 'translate_rent');
function translate_rent()
{
global $post;
$lang = substr(get_locale(), 0, 2);
if ('it' != $lang)
{
$period_lang = get_the_author_meta('periodo_affitti_$lang', $post->post_author);
if (!empty($period_lang)) {
return $period_lang;
} else {
return $period_lang;
}
} else {
return $period_lang;
}
}
"
instead of'
to evaluate variable in string"periodo_affitti_$lang"
. php.net/manual/en/…