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

what is the last $count in this example?

printf( _n(
    'You have published %s post.', 'You have published %s posts.',
    'myplugin' ),
$count );

i guess the first one is to fill each %s, so what is the second $count?


share|improve this question
up vote 2 down vote accepted

The _n (see Codex) function accepts four arguments. The first two are texts to be translated (the first is singular, the second plural), the third argument is a number (in this case $count). When $count is 1 the first string is used, otherwise the second string is used.

So in fact the first instance of $count is only used to determine whether the single / plural text should be used. _n then translates that string, using the plug-in/theme domain - i.e. the fourth argument) and the language set in the wp-config. This then returns a translated string such as:

Se han publicado %s artículos

The printf then echos this string with the %s replaced by the second argument, $count (which is the second instance of $count`) .

share|improve this answer
thanks Stephen Harris ! – Paul Mar 20 '12 at 3:00

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.