Created
March 3, 2014 21:34
-
-
Save certainlyakey/9335078 to your computer and use it in GitHub Desktop.
Wordpress - register custom post type
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
//Add custom post type (books) | |
function book_custompost_init() { | |
$labels_books = array( | |
'name' => _x('Публикации', 'post type general name'), | |
'singular_name' => _x('Публикация', 'post type singular name'), | |
'add_new' => _x('Добавить', 'book'), | |
'add_new_item' => __('Добавить '), | |
'edit_item' => __('Редактировать публикацию'), | |
'new_item' => __('Новая публикация'), | |
'all_items' => __('Все публикации'), | |
'view_item' => __('Просмотреть страницу публикации'), | |
'search_items' => __('Поиск публикаций'), | |
'not_found' => __('Ни одной публикации не найдено'), | |
'not_found_in_trash' => __('В корзине ни одной публикации не найдено'), | |
'parent_item_colon' => '', | |
'menu_name' => 'Публикации издательства' | |
); | |
$args = array( | |
'labels' => $labels_books, | |
'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' => 23, | |
'supports' => array( 'title', 'editor', 'custom-fields', 'excerpt', 'page-attributes' ) | |
); | |
register_post_type('book',$args); | |
} | |
add_action( 'init', 'book_custompost_init' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment