-
-
Save kellenmace/7454c8f897b49639d4a7fb944bf80797 to your computer and use it in GitHub Desktop.
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 | |
/** | |
* Register the Book custom post type. | |
*/ | |
function km_register_book_post_type() { | |
register_post_type( 'company', [ | |
'public' => true, | |
'supports' => [ 'title', 'editor', 'thumbnail' ], | |
'labels' => km_get_book_cpt_labels(), | |
] ); | |
} | |
add_action( 'init', 'km_register+book_post_type' ); | |
/** | |
* Get the labels for the Book custom post type. | |
*/ | |
function km_get_book_cpt_labels() { | |
return [ | |
'name' => _x( 'Books', 'Post type general name', 'textdomain' ), | |
'singular_name' => _x( 'Book', 'Post type singular name', 'textdomain' ), | |
'menu_name' => _x( 'Books', 'Admin Menu text', 'textdomain' ), | |
'name_admin_bar' => _x( 'Book', 'Add New on Toolbar', 'textdomain' ), | |
'add_new' => __( 'Add New', 'textdomain' ), | |
'add_new_item' => __( 'Add New Book', 'textdomain' ), | |
'new_item' => __( 'New Book', 'textdomain' ), | |
'edit_item' => __( 'Edit Book', 'textdomain' ), | |
'view_item' => __( 'View Book', 'textdomain' ), | |
'all_items' => __( 'All Books', 'textdomain' ), | |
'search_items' => __( 'Search Books', 'textdomain' ), | |
'parent_item_colon' => __( 'Parent Books:', 'textdomain' ), | |
'not_found' => __( 'No books found.', 'textdomain' ), | |
'not_found_in_trash' => __( 'No books found in Trash.', 'textdomain' ), | |
// Overrides the “Featured Image” label | |
'featured_image' => __( 'Book Cover Image', 'textdomain' ), | |
// Overrides the “Set featured image” label | |
'set_featured_image' => __( 'Set cover image', 'textdomain' ), | |
// Overrides the “Remove featured image” label | |
'remove_featured_image' => _x( 'Remove cover image', 'textdomain' ), | |
// Overrides the “Use as featured image” label | |
'use_featured_image' => _x( 'Use as cover image', 'textdomain' ), | |
]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment