在创建自定义帖子类型时,我收到了几个警告,有人建议我使用插件,但由于我是新手,我想知道发生了什么,所以我想手动执行。这是我收到的警告。
Warning: Missing argument 2 for _x(), called in C:\\xampp\\htdocs\\wordpress\\wp-content\\themes\\posttypes.php on line 8 and defined in C:\\xampp\\htdocs\\wordpress\\wp-includes\\l10n.php on line 189
Warning: Missing argument 2 for _x(), called in C:\\xampp\\htdocs\\wordpress\\wp-content\\themes\\posttypes.php on line 9 and defined in C:\\xampp\\htdocs\\wordpress\\wp-includes\\l10n.php on line 189
Warning: Missing argument 2 for _x(), called in C:\\xampp\\htdocs\\wordpress\\wp-content\\themes\\posttypes.php on line 28 and defined in C:\\xampp\\htdocs\\wordpress\\wp-includes\\l10n.php on line 189
Warning: Missing argument 2 for _x(), called in C:\\xampp\\htdocs\\wordpress\\wp-content\\themes\\posttypes.php on line 29 and defined in C:\\xampp\\htdocs\\wordpress\\wp-includes\\l10n.php on line 189
Warning: Missing argument 2 for _x(), called in C:\\xampp\\htdocs\\wordpress\\wp-content\\themes\\posttypes.php on line 48 and defined in C:\\xampp\\htdocs\\wordpress\\wp-includes\\l10n.php on line 189
Warning: Missing argument 2 for _x(), called in C:\\xampp\\htdocs\\wordpress\\wp-content\\themes\\posttypes.php on line 49 and defined in C:\\xampp\\htdocs\\wordpress\\wp-includes\\l10n.php on line 189
这是我的密码
<?php
//Add new post type for Models
add_action(\'init\', \'models_portfolio_init\');
function models_portfolio_init()
{
$args = array(
\'label\' => _x(\'Models\'),
\'singular_label\' => _x(\'Models\'),
\'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);
}
//Add new post type for Books
add_action(\'init\', \'books_posts_init\');
function books_posts_init()
{
$args = array(
\'label\' => _x(\'Books\'),
\'singular_label\' => _x(\'Books\'),
\'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(\'books\',$args);
}
//Add new post type for Advertisements
add_action(\'init\', \'advertisements_init\');
function advertisements_init()
{
$args = array(
\'label\' => _x(\'Advertisements\'),
\'singular_label\' => _x(\'Advertisements\'),
\'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(\'advertisements\',$args);
}
?>