Last active
August 29, 2015 14:11
-
-
Save niksudan/1b2d980559331f357e36 to your computer and use it in GitHub Desktop.
Assign custom post type labels quickly [WordPress]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Assign custom post type labels quickly | |
* | |
* @param string $singular | |
* @param string $plural | |
* @return array | |
*/ | |
function register_post_type_labels( $singular, $plural = NULL ) | |
{ | |
$plural = $plural == NULL ? $singular . 's' : $plural; | |
return array( | |
'name' => $plural, | |
'singular_name' => $singular, | |
'add_new' => 'Add New ' . $singular, | |
'add_new_item' => 'Add New ' . $singular, | |
'edit_item' => 'Edit ' . $singular, | |
'new_item' => 'New ' . $singular, | |
'view_item' => 'View ' . $singular, | |
'search_items' => 'Search ' . $plural, | |
'not_found' => 'No ' . $plural . ' found', | |
'not_found_in_trash' => 'No ' . $plural .' found in Trash', | |
'parent_item_colon' => 'Parent '. $singular . ':', | |
'menu_name' => $plural, | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment