Skip to content

Instantly share code, notes, and snippets.

@thegrid22593
Created November 22, 2017 01:42
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 thegrid22593/f4a516a210f8dbeeb011be49e7d5ee0c to your computer and use it in GitHub Desktop.
Save thegrid22593/f4a516a210f8dbeeb011be49e7d5ee0c to your computer and use it in GitHub Desktop.
WordPress Custom Post Type Register Function
add_action('init', 'create_units_post_type');
function create_units_post_type() {
$labels = array(
'name' => __('Site Plan'),
'singular_name' => __('Unit'),
'all_items' => __('All Units'),
'add_new' => _x('Add new Unit', 'Unit'),
'add_new_item' => __('Add new Unit'),
'edit_item' => __('Edit Unit'),
'new_item' => __('New Unit'),
'view_item' => __('View Unit'),
'search_items' => __('Search in Unit'),
'not_found' => __('No Unit found'),
'not_found_in_trash' => __('No Units found in trash'),
'parent_item_colon' => ''
);
$args = array (
'labels' => $labels,
'public' => true,
'has_archive' => true,
'menu_icon' => 'dashicons-admin-multisite',
'rewrite' => array('slug' => 'units'),
'taxonomies' => array( /*'category',*/ 'unit'),
'query_var' => true,
'menu_position' => 22,
'supports'=> array('thumbnail' , /*'custom-fields',*/ 'title', 'editor', 'excerpt')
);
register_post_type('units', $args);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment