_nc

Legacy version of _n(), which supports contexts.

Description

(string) _nc( (string) $single, (string) $plural, (number) $number, (string) $domain = 'default' ); 

Strips everything from the translation after the last bar.

Returns (string)

The translated singular or plural form.

Parameters (4)

0. $single (string)
The text to be used if the number is singular.
1. $plural (string)
The text to be used if the number is plural.
2. $number (number)
The number to compare against to use either the singular or plural form.
3. $domain — Optional. (string) => 'default'
Text domain. Unique identifier for retrieving translated strings. Default default..

Usage

  1. if ( !function_exists( '_nc' ) ) { 
  2. require_once ABSPATH . WPINC . '/deprecated.php'; 
  3.  
  4. // The text to be used if the number is singular. 
  5. $single = ''; 
  6.  
  7. // The text to be used if the number is plural. 
  8. $plural = ''; 
  9.  
  10. // The number to compare against to use either the singular or plural form. 
  11. $number = null; 
  12.  
  13. // Optional. Text domain. Unique identifier for retrieving translated strings. 
  14. // Default 'default'. 
  15. $domain = 'default'; 
  16.  
  17. // NOTICE! Understand what this does before running. 
  18. $result = _nc($single, $plural, $number, $domain); 
  19.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/deprecated.php  
  1. function _nc( $single, $plural, $number, $domain = 'default' ) { 
  2. _deprecated_function( __FUNCTION__, '2.9.0', '_nx()' ); 
  3. return before_last_bar( _n( $single, $plural, $number, $domain ) );