Existing code somewhere in a template or shortcode handler, display user profile biography:

<?php if ( $user ) : $bio = get_the_author_meta( 'description',  $user->ID ); ?>

<div class="esineja_info">
    <span class="bio"><?php echo $bio; ?></span>

How do I get these biographies to show up in WPML String Translation. This is not making it happen:

$bio = icl_t( 'theme', 'bio-' . $nimi, get_the_author_meta( 'description',  $user->ID ) );

This help page isn't particularly helpful to me, at least I cannot figure out how to apply it to this situation. This problem-specific thread is also quite vague on how exactly icl_t() is supposed to be used.


It turns out, my code above is indeed all that is needed. Apparently the mistake I made was that I didn't load the translated version of the page in the frontend at least once, so icl_t() didn't auto-register the strings.

Also keep in mind, if you're looking at correct string count in String Translation context names, you need to put "theme blah" as your context if you want icl_t() strings to get unified with the rest of the theme strings. Just icl_t( "blah", ... ) will create a new context named exactly "blah".

Not the answer you're looking for? Browse other questions tagged or ask your own question.