Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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>
</div>

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.

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

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".

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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