Last active
May 7, 2024 17:29
-
-
Save markodenic/ac8dac426922719cbbbd9a960acc3293 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function my_custom_post_event () { | |
$labels = array( | |
'name' => _x('Event', 'post type general name'), | |
'singular_name' => _x('Event', 'post type singular name'), | |
'add_new' => _x('Add new event', 'event'), | |
'add_new_item' => __('Add new event'), | |
'edit_item' => __('Edit event'), | |
'new_item' => __('New event'), | |
'all_items' => __('All events'), | |
'view_item' => __('View event'), | |
'search_items' => __('Search events'), | |
'not_found' => __('No events found'), | |
'not_found_in_trash' => __('No events found in trash'), | |
'parent_item_colon' => '', | |
'menu_name' => 'Events' | |
); | |
$args = array( | |
'labels' => $labels, | |
'description' => 'Event description', | |
'public' => true, | |
'menu_position' => 29, | |
'capability_type' => 'page', | |
'hierarchical' => true, | |
'rewrite' => true, | |
'supports' => array('title', 'editor', 'thumbnail', 'page-attributes', 'revisions'), | |
'has_archive' => true, | |
'menu_icon' => 'dashicons-admin-post', | |
'show_in_rest' => true, | |
); | |
register_post_type( 'event', $args ); | |
} | |
add_action( 'init', 'my_custom_post_event' ); | |
function my_taxonomies_event_type () { | |
$labels = array( | |
'name' => _x('Event category', 'taxonomy general name'), | |
'singular_name' => _x('Event category', 'taxonomy singular name'), | |
'search_items' => __('Search event categories'), | |
'all_items' => __('All event categories'), | |
'parent_item' => __('Event category parent'), | |
'parent_item_colon' => __('Event category parent'), | |
'edit_item' => __('edit event category'), | |
'update_item' => __('Update event category'), | |
'add_new_item' => __('Add new event category'), | |
'new_item_name' => __('New event category'), | |
'menu_name' => __('Event category'), | |
); | |
$args = array( | |
'labels' => $labels, | |
'hierarchical' => true, | |
); | |
register_taxonomy( 'event_type', 'event', $args ); | |
} | |
add_action( 'init', 'my_taxonomies_event_type', 0 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment