Last active
January 3, 2016 02:49
-
-
Save spraveenitpro/8397911 to your computer and use it in GitHub Desktop.
Add a New Custom Post Type Called Book
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 | |
/* | |
Plugin Name: Library Plugin | |
Author: Praveen selvasekaran | |
Author URI: hhttp://simpeltechlife.in | |
Description: The theme to to all themes | |
Version: 3.0 | |
License: GNU General Public License v2 or later | |
License URI: http://www.gnu.org/licenses/gpl-2.0.html | |
*/ | |
function books_custom_post() { | |
$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', | |
'all_items' => 'All Books', | |
'view_item' => 'View Book', | |
'search_items' => 'Search Books', | |
'not_found' => 'No books found', | |
'not_found_in_trash' => 'No books found in Trash', | |
'parent_item_colon' => '', | |
'menu_name' => 'Books' | |
); | |
$args = array( | |
'labels' => $labels, | |
'public' => true, | |
'publicly_queryable' => true, | |
'show_ui' => true, | |
'show_in_menu' => true, | |
'query_var' => true, | |
'rewrite' => array( 'slug' => 'book' ), | |
'capability_type' => 'post', | |
'has_archive' => true, | |
'hierarchical' => false, | |
'menu_position' => null, | |
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments','custom-fields' ) | |
); | |
register_post_type( 'book', $args ); | |
} | |
add_action( 'init', 'books_custom_post' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment