| 1 |
<?php |
| 2 |
/** |
| 3 |
* Register Event post type and related taxonomies |
| 4 |
* |
| 5 |
* @package Themify Event Post |
| 6 |
*/ |
| 7 |
|
| 8 |
if( ! function_exists( 'themify_event_post_register_post_type' ) ) : |
| 9 |
/** |
| 10 |
* Register post type and taxonomy |
| 11 |
*/ |
| 12 |
function themify_event_post_register_post_type() { |
| 13 |
register_post_type( 'event', array( |
| 14 |
'labels' => array( |
| 15 |
'name' => __('Events', 'themify-event-post'), |
| 16 |
'singular_name' => __('Event', 'themify-event-post'), |
| 17 |
'add_new' => __('Add New', 'themify-event-post'), |
| 18 |
'add_new_item' => __('Add New Event', 'themify-event-post'), |
| 19 |
'edit_item' => __('Edit Event', 'themify-event-post'), |
| 20 |
'new_item' => __('New Event', 'themify-event-post'), |
| 21 |
'view_item' => __('View Event', 'themify-event-post'), |
| 22 |
'search_items' => __('Search Events', 'themify-event-post'), |
| 23 |
'not_found' => __('No Events found', 'themify-event-post'), |
| 24 |
'not_found_in_trash' => __('No Events found in Trash', 'themify-event-post'), |
| 25 |
'menu_name' => __('Events', 'themify-event-post'), |
| 26 |
), |
| 27 |
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'custom-fields', 'excerpt', 'comments' ), |
| 28 |
'hierarchical' => false, |
| 29 |
'public' => true, |
| 30 |
'exclude_from_search' => false, |
| 31 |
'query_var' => true, |
| 32 |
'can_export' => true, |
| 33 |
'capability_type' => 'post', |
| 34 |
'menu_icon' => 'dashicons-calendar', |
| 35 |
'has_archive' => true, |
| 36 |
'rewrite' => array( |
| 37 |
'slug' => Themify_Event_Post::get_instance()->get_option( 'single_permalink', 'event' ), |
| 38 |
'feeds' => true, |
| 39 |
), |
| 40 |
'show_in_rest' => true |
| 41 |
)); |
| 42 |
|
| 43 |
register_taxonomy( 'event-category', array( 'event' ), array( |
| 44 |
'labels' => array( |
| 45 |
'name' => __( 'Event Categories', 'themify-event-post' ), |
| 46 |
'singular_name' => __( 'Event Categories', 'themify-event-post' ), |
| 47 |
'all_items' => __( 'All Event Categories', 'themify-event-post' ), |
| 48 |
), |
| 49 |
'public' => true, |
| 50 |
'show_in_nav_menus' => true, |
| 51 |
'show_ui' => true, |
| 52 |
'show_tagcloud' => true, |
| 53 |
'hierarchical' => true, |
| 54 |
'rewrite' => array( |
| 55 |
'slug' => Themify_Event_Post::get_instance()->get_option( 'category_permalink', 'event-category' ), |
| 56 |
), |
| 57 |
'query_var' => true, |
| 58 |
'show_in_rest' => true |
| 59 |
)); |
| 60 |
|
| 61 |
register_taxonomy( 'event-tag', array( 'event' ), array( |
| 62 |
'labels' => array( |
| 63 |
'name' => __( 'Event Tags', 'themify-event-post' ), |
| 64 |
'singular_name' => __( 'Event Tags', 'themify-event-post' ), |
| 65 |
), |
| 66 |
'public' => true, |
| 67 |
'show_in_nav_menus' => true, |
| 68 |
'show_ui' => true, |
| 69 |
'show_tagcloud' => true, |
| 70 |
'hierarchical' => false, |
| 71 |
'rewrite' => true, |
| 72 |
'query_var' => true, |
| 73 |
'show_in_rest' => true |
| 74 |
)); |
| 75 |
} |
| 76 |
endif; |
| 77 |
add_action( 'init', 'themify_event_post_register_post_type' ); |