WordPress.org

Ready to get started?Download WordPress

Codex

Function Reference/ nx

Contents

Description

A hybrid of _n() and _x(). It supports contexts and plurals.

Usage

<?php _nx$single$plural$number$context$domain ?>

Parameters

$single
(string) (required) The text that will be used if $number is 1
Default: None
$plural
(string) (required) The text that will be used if $number is not 1
Default: None
$number
(int) (required) The number to compare against to use either $single or $plural
Default: None
$context
(string) (required) Context information for the translators
Default: None
$domain
(string) (optional) Domain to retrieve the translated text
Default: 'default'

Return Values

(string) 
Either $single or $plural translated context string.

Examples

Notes

  • Uses the 'ngettext_with_context' filter.
  • l10n is an abbreviation for localization.

Change Log

Source File

_nx() is located in wp-includes/l10n.php.

Related

L10n: translate(), __(), _e(), _n(), _x(), _ex(), _nx(), esc_attr__(), esc_attr_e(), esc_attr_x(), esc_html__(), esc_html_e(), esc_html_x(), _n_noop(), _nx_noop(), translate_nooped_plural()

See also index of Function Reference and index of Template Tags.