5

您如何更改/重命名 WP 自定义帖子类型页面顶部的帖子状态文本

全部 | 发表 | 预定 | 草稿

4

1 回答 1

8

使用过滤器views_edit-{$post_type}。修改数组以设置所需的帖子类型:

foreach( array( 'post', 'portfolio' ) as $hook )
    add_filter( "views_edit-$hook", 'modified_views_so_15799171' );

function modified_views_so_15799171( $views ) 
{
    $views['all'] = str_replace( 'All ', 'Tutti ', $views['all'] );

    if( isset( $views['publish'] ) )
        $views['publish'] = str_replace( 'Published ', 'Online ', $views['publish'] );

    if( isset( $views['future'] ) )
        $views['future'] = str_replace( 'Scheduled ', 'Future ', $views['future'] );

    if( isset( $views['draft'] ) )
        $views['draft'] = str_replace( 'Drafts ', 'In progress ', $views['draft'] );

    if( isset( $views['trash'] ) )
        $views['trash'] = str_replace( 'Trash ', 'Dustbin ', $views['trash'] );

    return $views;
}

预习

于 2013-04-03T23:06:47.457 回答