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

closed as off-topic by Pieter Goosen, cybmeta, anu, G. M., birgire Nov 13 at 9:21

This question appears to be off-topic. The users who voted to close gave these specific reasons:

If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

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

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