| 1 |
<?php |
| 2 |
// Custom post types |
| 3 |
function kad_portfolio_post_init() { |
| 4 |
$portfoliolabels = array( |
| 5 |
'name' => __('Portfolio', 'kadencetoolkit'), |
| 6 |
'singular_name' => __('Portfolio Item', 'kadencetoolkit'), |
| 7 |
'add_new' => __('Add New', 'kadencetoolkit'), |
| 8 |
'add_new_item' => __('Add New Portfolio Item', 'kadencetoolkit'), |
| 9 |
'edit_item' => __('Edit Portfolio Item', 'kadencetoolkit'), |
| 10 |
'new_item' => __('New Portfolio Item', 'kadencetoolkit'), |
| 11 |
'all_items' => __('All Portfolio', 'kadencetoolkit'), |
| 12 |
'view_item' => __('View Portfolio Item', 'kadencetoolkit'), |
| 13 |
'search_items' => __('Search Portfolio', 'kadencetoolkit'), |
| 14 |
'not_found' => __('No Portfolio Item found', 'kadencetoolkit'), |
| 15 |
'not_found_in_trash' => __('No Portfolio Items found in Trash', 'kadencetoolkit'), |
| 16 |
'parent_item_colon' => '', |
| 17 |
'menu_name' => __('Portfolio', 'kadencetoolkit') |
| 18 |
); |
| 19 |
|
| 20 |
$portargs = array( |
| 21 |
'labels' => $portfoliolabels, |
| 22 |
'public' => true, |
| 23 |
'publicly_queryable' => true, |
| 24 |
'show_ui' => true, |
| 25 |
'show_in_menu' => true, |
| 26 |
'query_var' => true, |
| 27 |
'rewrite' => array( 'slug' => 'portfolio' ), /* you can specify its url slug */ |
| 28 |
'has_archive' => false, |
| 29 |
'capability_type' => 'post', |
| 30 |
'hierarchical' => false, |
| 31 |
'menu_position' => 8, |
| 32 |
'menu_icon' => 'dashicons-format-gallery', |
| 33 |
'supports' => array( 'title', 'editor', 'excerpt', 'author', 'page-attributes', 'thumbnail', 'custom-fields', 'comments' ) |
| 34 |
); |
| 35 |
// Initialize Taxonomy Labels |
| 36 |
$worklabels = array( |
| 37 |
'name' => __( 'Portfolio Type', 'kadencetoolkit' ), |
| 38 |
'singular_name' => __( 'Type', 'kadencetoolkit' ), |
| 39 |
'search_items' => __( 'Search Type', 'kadencetoolkit' ), |
| 40 |
'all_items' => __( 'All Type', 'kadencetoolkit' ), |
| 41 |
'parent_item' => __( 'Parent Type', 'kadencetoolkit' ), |
| 42 |
'parent_item_colon' => __( 'Parent Type:', 'kadencetoolkit' ), |
| 43 |
'edit_item' => __( 'Edit Type', 'kadencetoolkit' ), |
| 44 |
'update_item' => __( 'Update Type', 'kadencetoolkit' ), |
| 45 |
'add_new_item' => __( 'Add New Type', 'kadencetoolkit' ), |
| 46 |
'new_item_name' => __( 'New Type Name', 'kadencetoolkit' ), |
| 47 |
); |
| 48 |
// Register Custom Taxonomy |
| 49 |
register_taxonomy('portfolio-type',array('portfolio'), array( |
| 50 |
'hierarchical' => true, // define whether to use a system like tags or categories |
| 51 |
'labels' => $worklabels, |
| 52 |
'show_ui' => true, |
| 53 |
'query_var' => true, |
| 54 |
'rewrite' => true, |
| 55 |
)); |
| 56 |
|
| 57 |
register_post_type( 'portfolio', $portargs ); |
| 58 |
} |
| 59 |
add_action( 'init', 'kad_portfolio_post_init', 1 ); |
| 60 |
|
| 61 |
|