-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtickets-cpt.php
More file actions
69 lines (62 loc) · 2.18 KB
/
tickets-cpt.php
File metadata and controls
69 lines (62 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
/**
* Add CPT tickets
*
* @package gemeindetage-anmeldung
*/
namespace gemeindetag\anmeldung;
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
add_action( 'init', __NAMESPACE__ . '\custom_post_type_tickets', 0 );
/**
* Adding CPT tickets
*/
function custom_post_type_tickets() {
$labels = [
'name' => __( 'Tickets', 'gemeindetag' ),
'singular_name' => __( 'Ticket', 'gemeindetag' ),
'menu_name' => __( 'Tickets', 'gemeindetag' ),
'all_items' => __( 'Alle Tickets', 'gemeindetag' ),
'view_item' => __( 'Ticket Anzeigen', 'gemeindetag' ),
'add_new_item' => __( 'Neues Ticket hinzufügen', 'gemeindetag' ),
'add_new' => __( 'Neues hinzufügen', 'gemeindetag' ),
'edit_item' => __( 'Ticket bearbeiten', 'gemeindetag' ),
'update_item' => __( 'Ticket Aktualisieren', 'gemeindetag' ),
'search_items' => __( 'Ticket Suchen', 'gemeindetag' ),
'not_found' => __( 'Nichts gefunden', 'gemeindetag' ),
'not_found_in_trash' => __( 'Nichts im Papierkorb gefunden', 'gemeindetag' ),
];
$args = [
'labels' => $labels,
'description' => __( 'Tickets', 'gemeindetag' ),
'menu_icon' => 'dashicons-tickets',
'supports' => [ 'title', 'editor', 'meta', 'custom-fields' ],
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 20,
'can_export' => true,
'has_archive' => false,
'exclude_from_search' => true,
'publicly_queryable' => true,
'capability_type' => 'post',
'show_in_rest' => true,
'rest_base' => 'tickets',
'template' => [
[ 'gemeindetag/ticket' ]
],
'template_lock' => 'all',
];
register_post_type( 'tickets', $args );
}
$string = [
'type' => 'string',
'single' => true,
'show_in_rest' => true,
];
register_post_meta( 'tickets', 'price_adult', $string );
register_post_meta( 'tickets', 'price_teen', $string );
register_post_meta( 'tickets', 'price_kid', $string );