admin管理员组

文章数量:1122846

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;
    }

} 

本文标签: phpHow can I make this shortcode multilanguage