WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

$output .= '<li class="recentcomments">' . sprintf(_x('%1$s %2$s - %3$s %4$s', 'thst'), get_avatar( $comment, 48 ), (...);

This is my line of code and Wordpress Theme Checker tells me "Text domain problems. You have not included a text domain!" I have included one though, as you can see. What could be the problem here?

share|improve this question
up vote 1 down vote accepted

_x() is for string with a context. So your second argument is just the context, and there is no text domain.


$string = _x( 
'%1$s %2$s - %3$s %4$s',                # string to translate
'recent comments 1 = gravatar, 2 = … ', # context for translators
'thst'                                  # text domain

$visible = sprintf( $string, get_avatar( $comment, 48 ), … );

$output .= '<li class="recentcomments">' . $visible . '</li>';

Explain all numbers in your context parameter.

share|improve this answer
$output .= '<li class="recentcomments">' . /* translators: comments widget: 1: comment author, 2: post link */ sprintf(_x('%1$s %2$s - %3$s %4$s'), get_avatar( $comment, 48 ), '<div class="text">' . get_comment_author_link() , '<a href="' . esc_url( get_comment_link($comment->comment_ID) ) . '">' . get_the_title($comment->comment_post_ID) . '</a>', '<p class="date">' . get_comment_date('l, j F Y') . '</p></div>', 'thst') . '</li>'; Ok I got it now. the text domain needed to go at the very end since the other things in the middle are numbers. Thanks! – charlenemasters Feb 14 '13 at 10:48
No, use a context parameter and a text domain as explained in my answer. – toscho Feb 14 '13 at 10:49
Ok I'm not sure I understand. All the elements after x_() are the elements that are inserted into '%1$s'... How does the context parameter come into this? What is it, what does it do and where do I put it? – charlenemasters Feb 14 '13 at 11:01
@charlenemasters I made an update to my answer to show better how it works. Is that better? – toscho Feb 14 '13 at 11:10
Got it to work and I understand it now. Thanks a lot! – charlenemasters Feb 14 '13 at 11:42

Your Answer


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.