Created
May 19, 2016 20:31
-
-
Save ronalfy/c2be71b52c626aa20a83fc2847cb5162 to your computer and use it in GitHub Desktop.
Custom Post Types Template Init
This file contains hidden or 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 | |
public function init() { | |
add_action( 'add_meta_boxes', array( &$this, 'register_meta_boxes' ) ); | |
$labels = array( | |
'name' => 'Galleries', | |
'singular_name' => 'Gallery', | |
'menu_name' => 'Galleries', | |
'name_admin_bar' => 'Galleries', | |
'add_new' => 'Add New', | |
'add_new_item' => 'Add New Gallery', | |
'new_item' => 'New Gallery', | |
'edit_item' => 'Edit Gallery', | |
'view_item' => 'View Gallery', | |
'all_items' => 'All Galleries', | |
'search_items' => 'Search Galleries', | |
'parent_item_colon' => 'Parent Gallery:', | |
'not_found' => 'No Galleries found.', | |
'not_found_in_trash' => 'No Galleries in trash.' | |
); | |
register_post_type( 'gallery', array( | |
'public' => true, | |
'label' => 'Galleries', | |
'labels' => $labels, | |
'hierarchical' => false, | |
'menu_position' => 20, | |
'menu_icon' => 'dashicons-format-image', | |
'supports' => array( 'title', 'page-attributes' ), | |
'has_archive' => true, | |
'rewrite' => array( | |
'slug' => 'gallery', | |
'with_front' => false, | |
) | |
) ); | |
$labels = array( | |
'name' => 'Books', | |
'singular_name' => 'Book', | |
'menu_name' => 'Books', | |
'name_admin_bar' => 'Books', | |
'add_new' => 'Add New', | |
'add_new_item' => 'Add New Book', | |
'new_item' => 'New Book', | |
'edit_item' => 'Edit Book', | |
'view_item' => 'View Book', | |
'all_items' => 'All Books', | |
'search_items' => 'Search Books', | |
'parent_item_colon' => 'Parent Book:', | |
'not_found' => 'No Books found.', | |
'not_found_in_trash' => 'No Books in trash.' | |
); | |
register_post_type( 'book', array( | |
'public' => true, | |
'label' => 'Books', | |
'labels' => $labels, | |
'hierarchical' => false, | |
'menu_position' => 20, | |
'menu_icon' => 'dashicons-format-aside', | |
'supports' => array( 'title', 'page-attributes' ), | |
'has_archive' => true, | |
'rewrite' => array( | |
'slug' => 'book', | |
'with_front' => false, | |
) | |
) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment