Jav*_*eva 6 wordpress wordpress-theming
有没有办法更改管理区域内菜单项的标签?就像当您为其指定每个标签时注册新的自定义帖子类型时,但是对于默认菜单项.
提前致谢!
joe*_*oel 13
add_filter( 'gettext', 'change_post_to_article' );
add_filter( 'ngettext', 'change_post_to_article' );
function change_post_to_article( $translated )
{
$translated = str_replace( 'Post', 'Article', $translated );
$translated = str_replace( 'post', 'article', $translated );
return $translated;
}
Run Code Online (Sandbox Code Playgroud)
还有另一种方法可以做到这一点,更多信息请查看此答案.
最好的解决方案是这样,只需在您的functions.php或插件文件中写入
function change_post_menu_label() {
global $menu;
global $submenu;
$menu[70][0] = 'Articles';
$submenu['user-edit.php'][5][0] = 'Articles';
$submenu['user-edit.php'][10][0] = 'Add Articles';
echo '';
}
function change_post_object_label() {
global $wp_post_types;
$labels = &$wp_post_types['users']->labels;
$labels->name = 'Articles';
$labels->singular_name = 'Article';
$labels->add_new = 'Add Article';
$labels->add_new_item = 'Add Article';
$labels->edit_item = 'Edit Article';
$labels->new_item = 'Article';
$labels->view_item = 'View Article';
$labels->search_items = 'Search Articles';
$labels->not_found = 'No Articles found';
$labels->not_found_in_trash = 'No Articles found in Trash';
}
add_action( 'init', 'change_post_object_label' );
add_action( 'admin_menu', 'change_post_menu_label' );
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12823 次 |
| 最近记录: |