-
Notifications
You must be signed in to change notification settings - Fork 0
/
savingdotworld.php
131 lines (111 loc) · 3.28 KB
/
savingdotworld.php
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?php
/*
Plugin Name: Saving.World
Plugin URI: http://saving.world
Description: Customizations for the saving.world website
Version: 0.5
Author: Wayne Moses Burke
Author URI: http://waynemosesburke.com/
License: ALv2
License URI: https://www.apache.org/licenses/LICENSE-2.0
Domain Path: /savingdotworld
*/
/*defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
*/
// The register_post_type() function is not to be used before the 'init'.
add_action( 'init', 'sdw_activity_init' );
/* Here's how to create your customized labels */
function sdw_activity_init() {
$labels = array(
'name' => _x( 'Activities', 'custom post type generic name' ), // Tip: _x('') is used for localization
'singular_name' => _x( 'Activity', 'individual custom post type name' ),
'add_new' => _x( 'Add New', 'add' ),
'add_new_item' => __( 'Add New Activity' ),
'edit_item' => __( 'Edit Activity' ),
'new_item' => __( 'New Activity' ),
'view_item' => __( 'View Activity' ),
'search_items' => __( 'Search Activities' ),
'not_found' => __( 'No Activity Found' ),
'not_found_in_trash' => __( 'No Activity Found in trash' ),
'parent_item_colon' => ''
);
// Create an array for the $args
$args = array( 'labels' => $labels, /* NOTICE: the $labels variable is used here... */
'public' => true,
'publicly_queryable' => true,
'menu_position' => 20,
'menu_icon' => 'dashicons-yes',
'supports' => array(
'title',
'editor',
'thumbnail',
'custom-fields',
'comments',
'revisions',
),
'has_archive' => true
);
register_post_type( 'sdw_activity', $args ); /* Register it and move on */
}
add_action( 'init', 'sdw_activity_issues_init' );
function sdw_activity_issues_init() {
register_taxonomy(
'sdw_activity_issues',
'sdw_activity',
array(
'label' => __( 'Issues' ),
'rewrite' => array( 'slug' => 'issues' ),
'update_count_callback' => '_update_post_term_count'
)
);
}
add_action( 'init', 'sdw_activity_type_init' );
function sdw_activity_type_init() {
register_taxonomy(
'sdw_activity_type',
'sdw_activity',
array(
'label' => __( 'Activity Type' ),
'rewrite' => array( 'slug' => 'activityType' ),
)
);
}
add_action( 'init', 'sdw_venue_type_init' );
function sdw_venue_type_init() {
register_taxonomy(
'sdw_venue_type',
'sdw_activity',
array(
'label' => __( 'Venue Type' ),
'rewrite' => array( 'slug' => 'venueType' ),
)
);
}
add_action( 'init', 'sdw_venue_city_init' );
function sdw_venue_city_init() {
register_taxonomy(
'sdw_venue_city',
'sdw_activity',
array(
'label' => __( 'Venue City' ),
'rewrite' => array( 'slug' => 'venueCity' ),
)
);
}
function sdw_install() {
// Trigger our function that registers the custom post type
sdw_activity_init();
// Trigger our function that registers the custom taxonomies
sdw_activity_issues_init();
sdw_activity_type_init();
// Clear the permalinks after the post type has been registered
flush_rewrite_rules();
}
register_activation_hook( __FILE__, 'sdw_install' );
function sdw_deactivation() {
// Our post type will be automatically removed, so no need to unregister it
// Clear the permalinks to remove our post type's rules
flush_rewrite_rules();
}
register_deactivation_hook( __FILE__, 'sdw_deactivation' );
?>