Skip to content

Instantly share code, notes, and snippets.

@vladimirlukyanov
Created September 6, 2015 23:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vladimirlukyanov/0d14adc83f30a90cd1fd to your computer and use it in GitHub Desktop.
Save vladimirlukyanov/0d14adc83f30a90cd1fd to your computer and use it in GitHub Desktop.
Register custom post type WordPress
<?php
// Register casino
$labels = array(
'name' => __('Casino', 'tps'),
'singular_name' => __('Casino', 'tps'),
'add_new' => __('Add casino', 'tps'),
'add_new_item' => __('Add new casino', 'tps'),
'edit_item' => __('Edit casino', 'tps'),
'new_item' => __('New casino', 'tps'),
'all_items' => __('All casinos', 'tps'),
'view_item' => __('View casino', 'tps'),
'search_items' => __('Search', 'tps'),
'not_found' => __('No casino found', 'tps'),
'not_found_in_trash' => __('No casino found in trash', 'tps'),
'parent_item_colon' => '',
'menu_name' => __('Casino', 'tps'),
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'exclude_from_search' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_meanus' => true,
'query_var' => true,
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => 6,
'supports' => array('title', 'editor', 'thumbnail'),
'rewrite' => array('slug' => 'casino'),
'with_front' => false
);
register_post_type('casino', $args);
register_taxonomy('software', 'casino',
array('hierarchical' => false,
'label' => 'Software',
'query_var' => true,
'rewrite' => true));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment