_n
_n ( $single, $plural, $number, $domain = 'default' )
Parameters:- (string) single The text to be used if the number is singular.
- (string) plural The text to be used if the number is plural.
- (int) number The number to compare against to use either the singular or plural form.
- (string) domain Optional. Text domain. Unique identifier for retrieving translated strings. Default 'default'.
Returns:- (string) The translated singular or plural form.
Defined at:Change Log: - Introduced in WordPress: 2.8.0
- Deprecated in WordPress: —
Description
Translates and retrieves the singular or plural form based on the supplied number.Used when you want to use the appropriate form of a string based on whether a
number is singular or plural.
Example:
printf( _n( '%s person', '%s people', $count, 'text-domain' ), number_format_i18n( $count ) );