-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpost_types.php
More file actions
72 lines (69 loc) · 1.88 KB
/
post_types.php
File metadata and controls
72 lines (69 loc) · 1.88 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
70
71
72
<?php
/* ###### ########
* ######### #########
* #### #### ####
* #### #########
* #### #######
* #### ####
* ######### ####
* ###### ####
*
*
* This file deals with creating the Custom Types for the plugin,
* These include:
* Tickets
*/
function cpt_create_ticket_type()
{
$labels_array = array(
'name' => __('Tickets'),
'singular_name' => __('Ticket'),
'menu_name' => __('Tickets'),
'search_items' => __('Tickets'),
'not_found' => __('Ticket'),
'add_new_item' => __('Add New Ticket'),
);
$supports_array = array(
'title',
'editor',
'author',
'custom-fields',
'comments'
);
$taxonomies = array(
'cp_support_product',
'cp_ticket_types',
'cp_ticket_status'
);
$post_formats = array(
'aside',
'status',
'chat'
);
$args = array(
'label' => 'CP Tickets',
'labels' => $labels_array,
'description' => 'Tickets of any type that you need to keep track of',
'public' => true,
'menu_icon' => plugins_url( 'images/ticketicon16.png' , __FILE__ ),
'supports' => $supports_array,
'taxonomies' => $taxonomies,
'rewrite' => false,
'post-formats' => $post_formats,
);
register_post_type('cp_ticket', $args);
}
add_action('init', 'cpt_create_ticket_type');
// Adds the header image to the Tickets...
function cpt_plugin_header() {
global $post_type;
?>
<style>
<?php if (($_GET['post_type'] == 'cp_ticket') || ($post_type == 'cp_ticket')) : ?>
#icon-edit { background:transparent url('<?php echo plugins_url( 'images/ticketicon32.png' , __FILE__ );?>') no-repeat; }
<?php endif; ?>
</style>
<?php
}
add_action('admin_head', 'cpt_plugin_header');
?>