Reputation: 11
WordPress is throwing this error message:
Warning: Missing argument 2 for
_x()
, called in "directory/posttypes.php" on line 8 and defined in "directory/l10n.php on line 250
postypes.php:
// Add new post type for Recipes
add_action('init', 'cooking_recipes_init');
function cooking_recipes_init()
{
$args = array(
'label' => _x('Recipes'),
'singular_label' => _x('Recipe'),
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true,
'rewrite' => true,
'capability_type' => 'post',
'hierarchical' => false,
'menu_position' => null,
'supports' => array('title','editor','comments')
);
register_post_type('recipes',$args);
}
functions.php:
include_once(ABSPATH . 'wp-content/themes/twentyeleven-child/posttypes.php');
l10n.php:
function _x( $text, $context, $domain = 'default' ) {
return translate_with_gettext_context( $text, $context, $domain );
}
any advice would be much appreciated, thanks
Upvotes: 0
Views: 320
Reputation: 27112
As the error states, the _x()
function has two required parameters: (1) the string of text to be translated, (2) context information for the translators.
If you don't need to include context, you can use __()
. If you don't need to translate the string...don't use either function.
Either of the following would be valid:
'label' => __('Recipes'),
'singular_label' => __('Recipe'),
or...
'label' => 'Recipes',
'singular_label' => 'Recipe',
Upvotes: 3