Skip to content

Instantly share code, notes, and snippets.

@artursopelnik
Created September 7, 2018 14:33
Show Gist options
  • Save artursopelnik/422cf785c3c91d759d8e8e702bfb36f3 to your computer and use it in GitHub Desktop.
Save artursopelnik/422cf785c3c91d759d8e8e702bfb36f3 to your computer and use it in GitHub Desktop.
wordpress taxonomy manager
<?php
if (!function_exists('custom_post_type')) {
// Register Custom Post Type
function custom_post_type()
{
$labels = array(
'name' => _x('Houseplans', 'Post Type General Name', 'twentysixteen'),
'singular_name' => _x('Houseplan', 'Post Type Singular Name', 'twentysixteen'),
'menu_name' => __('House Plans', 'twentysixteen'),
'name_admin_bar' => __('House Plans', 'twentysixteen'),
'archives' => __('Item Archives', 'twentysixteen'),
'parent_item_colon' => __('Parent Item:', 'twentysixteen'),
'all_items' => __('All Items', 'twentysixteen'),
'add_new_item' => __('Add New Item', 'twentysixteen'),
'add_new' => __('Add New', 'twentysixteen'),
'new_item' => __('New Item', 'twentysixteen'),
'edit_item' => __('Edit Item', 'twentysixteen'),
'update_item' => __('Update Item', 'twentysixteen'),
'view_item' => __('View Item', 'twentysixteen'),
'search_items' => __('Search Item', 'twentysixteen'),
'not_found' => __('Not found', 'twentysixteen'),
'not_found_in_trash' => __('Not found in Trash', 'twentysixteen'),
'featured_image' => __('Featured Image', 'twentysixteen'),
'set_featured_image' => __('Set featured image', 'twentysixteen'),
'remove_featured_image' => __('Remove featured image', 'twentysixteen'),
'use_featured_image' => __('Use as featured image', 'twentysixteen'),
'insert_into_item' => __('Insert into item', 'twentysixteen'),
'uploaded_to_this_item' => __('Uploaded to this item', 'twentysixteen'),
'items_list' => __('Items list', 'twentysixteen'),
'items_list_navigation' => __('Items list navigation', 'twentysixteen'),
'filter_items_list' => __('Filter items list', 'twentysixteen'),
);
$args = array(
'label' => __('Houseplan', 'twentysixteen'),
'description' => __('house plans custom postype', 'twentysixteen'),
'labels' => $labels,
'supports' => array('title', 'editor', 'thumbnail',),
'taxonomies' => array('category'),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-admin-multisite',
'show_in_admin_bar' => false,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
);
register_post_type('houseplan', $args);
}
add_action('init', 'custom_post_type', 0);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment