August 2017
Beginner
412 pages
10h 30m
English
You can add labels to your custom post type so that WordPress knows what to say when talking about it. First, let's simply create an array of all the labels. Put this as the first thing inside the book_init() function:
$labels = array( 'name' => 'Books', 'singular_name' => 'Book', 'add_new' => 'Add New', 'add_new_item' => 'Add New Book', 'edit_item' => 'Edit Book', 'new_item' => 'New Book', 'view_item' => 'View Book', 'search_items' => 'Search Books', 'not_found' => 'No books found', 'not_found_in_trash' => 'No books found in Trash' );
Then, add a single line of code to the $args array telling it to use the labels, as shown in the following snippet:
$args = array( 'labels' => $labels, 'description' => 'A custom post type that ...
Read now
Unlock full access