Skip to content

Instantly share code, notes, and snippets.

@ajskelton
Created February 17, 2017 01:23
Show Gist options
  • Save ajskelton/d5a744a68e9f97baab6790ccbb152013 to your computer and use it in GitHub Desktop.
Save ajskelton/d5a744a68e9f97baab6790ccbb152013 to your computer and use it in GitHub Desktop.
WordPress Custom Post Type Labels
/**
* Get the post type labels configuration
*
* @param string $post_type
* @param string $singular_label
* @param string $plural_label
*
* @return array
*/
function get_TODO_post_type_labels_config( $post_type, $singular_label, $plural_label ) {
return array(
'name' => _x( $plural_label, 'post type general name', FAQ_MODULE_TEXT_DOMAIN ),
'singular_name' => _x( $singular_label, 'post type singular name', FAQ_MODULE_TEXT_DOMAIN ),
'menu_name' => _x( $plural_label, 'admin menu', FAQ_MODULE_TEXT_DOMAIN ),
'name_admin_bar' => _x( $singular_label, 'add new on admin bar', FAQ_MODULE_TEXT_DOMAIN ),
'add_new' => _x( 'Add New ', $post_type, FAQ_MODULE_TEXT_DOMAIN ),
'add_new_item' => __( 'Add New ' . $singular_label, FAQ_MODULE_TEXT_DOMAIN ),
'new_item' => __( 'New ' . $singular_label, FAQ_MODULE_TEXT_DOMAIN ),
'edit_item' => __( 'Edit ' . $singular_label, FAQ_MODULE_TEXT_DOMAIN ),
'view_item' => __( 'View ' . $singular_label, FAQ_MODULE_TEXT_DOMAIN ),
'all_items' => __( 'All ' . $plural_label, FAQ_MODULE_TEXT_DOMAIN ),
'search_items' => __( 'Search ' . $plural_label, FAQ_MODULE_TEXT_DOMAIN ),
'parent_item_colon' => __( 'Parent ' . $singular_label . ':', FAQ_MODULE_TEXT_DOMAIN ),
'not_found' => __( 'No ' . $plural_label . ' found.', FAQ_MODULE_TEXT_DOMAIN ),
'not_found_in_trash' => __( 'No ' . $plural_label . ' found in Trash.', FAQ_MODULE_TEXT_DOMAIN )
);
}
@harnerdesigns
Copy link

Thanks for this! Saved me a decent bit of time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment