Custom Post Type UI - Version 0.9.0

Version Description

  • CPTUI has been given a new UI!
  • Separated out post type and taxonomy creation to their own screens.
  • Added import/export ability for post type and taxonomy settings.
  • Added a Help/Support Screen.
  • Added/Updated available parameters for post types and parameters.
  • Updated i18n and translation files.
  • Added Confirmation prompts before deleting post types and taxonomies.
  • Added actions and filters for 3rd party customization.
  • Added function that automatically converts 0.8.x and down settings to new setting arrangement.
  • Changed how settings are stored so that post types and taxonomies are in named array indexes.
  • Bug fixes not mentioned above.
Download this release

Release Info

Developer tw2113
Plugin Icon 128x128 Custom Post Type UI
Version 0.9.0
Comparing to
See all releases

Code changes from version 0.8.5 to 0.9.0

classes/class.cptui_admin_ui.php ADDED
@@ -0,0 +1,386 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Ideas: $this->get_td( $content ). Returns content wrapped in <td>. Similar with $this->get_tr(), $this->th()
4
+ */
5
+
6
+ /**
7
+ * Custom Post Type UI Admin UI
8
+ */
9
+ class cptui_admin_ui {
10
+
11
+ /**
12
+ * Return an opening <tr> tag.
13
+ *
14
+ * @since 1.0
15
+ *
16
+ * @return string $value Opening <tr> tag with attributes.
17
+ */
18
+ public function get_tr_start() {
19
+ return '<tr valign="top">';
20
+ }
21
+
22
+ /**
23
+ * Return a closing </tr> tag.
24
+ *
25
+ * @since 1.0
26
+ *
27
+ * @return string $value Closing </tr> tag.
28
+ */
29
+ public function get_tr_end() {
30
+ return '</tr>';
31
+ }
32
+
33
+ /**
34
+ * Return an opening <th> tag.
35
+ *
36
+ * @since 1.0
37
+ *
38
+ * @return string $value Opening <th> tag with attributes.
39
+ */
40
+ public function get_th_start() {
41
+ return '<th scope="row">';
42
+ }
43
+
44
+ /**
45
+ * Return a closing </th> tag.
46
+ *
47
+ * @since 1.0
48
+ *
49
+ * @return string $value Closing </th> tag.
50
+ */
51
+ public function get_th_end() {
52
+ return '</th>';
53
+ }
54
+
55
+ /**
56
+ * Return an opening <td> tag.
57
+ *
58
+ * @since 1.0
59
+ *
60
+ * @return string $value Opening <td> tag.
61
+ */
62
+ public function get_td_start() {
63
+ return '<td>';
64
+ }
65
+
66
+ /**
67
+ * Return a closing </td> tag.
68
+ *
69
+ * @since 1.0
70
+ *
71
+ * @return string $value Closing </td> tag.
72
+ */
73
+ public function get_td_end() {
74
+ return '</td>';
75
+ }
76
+
77
+ /**
78
+ * Return string wrapped in a <p> tag.
79
+ *
80
+ * @since 1.0
81
+ *
82
+ * @param string $text Content to wrap in a <p> tag.
83
+ *
84
+ * @return string $value Content wrapped in a <p> tag.
85
+ */
86
+ public function get_p( $text = '' ) {
87
+ return '<p>' . strip_tags( $text ) . '</p>';
88
+ }
89
+
90
+ /**
91
+ * Return a form <label> with for attribute.
92
+ *
93
+ * @since 1.0
94
+ *
95
+ * @param string $label_for Form input to associate <label> with.
96
+ * @param string $label_text Text to display in the <label> tag.
97
+ *
98
+ * @return string $value <label> tag with filled out parts.
99
+ */
100
+ public function get_label( $label_for = '', $label_text = '' ) {
101
+ return '<label for="' . esc_attr( $label_for ) . '">' . strip_tags( $label_text ) . '</label>';
102
+ }
103
+
104
+ /**
105
+ * Return a <span> to indicate required status, with class attribute.
106
+ *
107
+ * @since 1.0
108
+ *
109
+ * @return string span tag.
110
+ */
111
+ public function get_required() {
112
+ return '<span class="required">*</span>';
113
+ }
114
+
115
+ /**
116
+ * Return an <a> tag with title attribute holding help text.
117
+ *
118
+ * @since 1.0
119
+ *
120
+ * @param string $help_text Text to use in the title attribute.
121
+ *
122
+ * @return string <a> tag with filled out parts.
123
+ */
124
+ public function get_help( $help_text = '' ) {
125
+ return '<a href="#" title="' . esc_attr( $help_text ) . '" class="help wp-ui-highlight">?</a>';
126
+ }
127
+
128
+ /**
129
+ * Return a maxlength HTML attribute with a specified length.
130
+ *
131
+ * @param string $length How many characters the max length should be set to.
132
+ *
133
+ * @return string $value Maxlength HTML attribute.
134
+ */
135
+ public function get_maxlength( $length = '' ) {
136
+ return 'maxlength="' . esc_attr( $length ) . '"';
137
+ }
138
+
139
+ /**
140
+ * Return a onblur HTML attribute for a specified value.
141
+ *
142
+ * @param string $text Text to place in the onblur attribute.
143
+ *
144
+ * @return string $value Onblur HTML attribute.
145
+ */
146
+ public function get_onblur( $text = '' ) {
147
+ return 'onblur="' . esc_attr( $text ) . '"';
148
+ }
149
+
150
+ /**
151
+ * Return a populated <select> input.
152
+ *
153
+ * @since 1.0
154
+ *
155
+ * @param array $args Arguments to use with the <select> input.
156
+ *
157
+ * @return string $value Complete <select> input with options and selected attribute.
158
+ */
159
+ public function get_select_input( $args = array() ) {
160
+ $defaults = $this->get_default_input_parameters(
161
+ array( 'selections' => array() )
162
+ );
163
+
164
+ $args = wp_parse_args( $args, $defaults );
165
+
166
+ $value = '';
167
+ if ( $args['wrap'] ) {
168
+ $value = $this->get_tr_start();
169
+ $value .= $this->get_th_start();
170
+ $value .= $this->get_label( $args['name'], $args['labeltext'] );
171
+ if ( $args['required'] ) { $value .= $this->get_required(); }
172
+ if ( !empty( $args['helptext'] ) ) { $value .= $this->get_help( $args['helptext'] ); }
173
+ $value .= $this->get_th_end();
174
+ $value .= $this->get_td_start();
175
+ }
176
+
177
+ $value .= '<select id="' . $args['name'] . '" name="' . $args['namearray'] . '[' . $args['name'] . ']">';
178
+ if ( !empty( $args['selections']['options'] ) && is_array( $args['selections']['options'] ) ) {
179
+ foreach( $args['selections']['options'] as $val ) {
180
+ $result = '';
181
+ $bool = disp_boolean( $val['attr'] );
182
+
183
+ if ( is_numeric( $args['selections']['selected'] ) ) {
184
+ $selected = disp_boolean( $args['selections']['selected'] );
185
+ } elseif ( in_array( $args['selections']['selected'], array( 'true', 'false' ) ) ) {
186
+ $selected = $args['selections']['selected'];
187
+ }
188
+
189
+ if ( ( !empty( $selected ) ) && $selected === $bool ) {
190
+ $result = ' selected="selected"';
191
+ } else {
192
+ if ( array_key_exists( 'default', $val ) && !empty( $val['default'] ) ) {
193
+ if ( empty( $selected ) ) {
194
+ $result = ' selected="selected"';
195
+ }
196
+ }
197
+ }
198
+
199
+ if ( !is_numeric( $args['selections']['selected'] ) && ( !empty( $args['selections']['selected'] ) && $args['selections']['selected'] == $val['attr'] ) ) {
200
+ $result = ' selected="selected"';
201
+ }
202
+
203
+ $value .= '<option value="' . $val['attr'] . '"' . $result . '>' . $val['text'] . '</option>';
204
+ }
205
+ }
206
+ $value .= '</select>';
207
+
208
+ if ( !empty( $args['aftertext'] ) )
209
+ $value .= $args['aftertext'];
210
+
211
+ if ( $args['wrap'] ) {
212
+ $value .= $this->get_td_end();
213
+ $value .= $this->get_tr_end();
214
+ }
215
+
216
+ return $value;
217
+ }
218
+
219
+ /**
220
+ * Return a text input.
221
+ *
222
+ * @since 1.0
223
+ *
224
+ * @param array $args Arguments to use with the text input.
225
+ *
226
+ * @return string Complete text <input> with proper attributes.
227
+ */
228
+ public function get_text_input( $args = array() ) {
229
+ $defaults = $this->get_default_input_parameters(
230
+ array(
231
+ 'maxlength' => '',
232
+ 'onblur' => '',
233
+ )
234
+ );
235
+ $args = wp_parse_args( $args, $defaults );
236
+
237
+ $value = '';
238
+ if ( $args['wrap'] ) {
239
+ $value .= $this->get_tr_start();
240
+ $value .= $this->get_th_start();
241
+ $value .= $this->get_label( $args['name'], $args['labeltext'] );
242
+ if ( $args['required'] ) { $value .= $this->get_required(); }
243
+ $value .= $this->get_help( $args['helptext'] );
244
+ $value .= $this->get_th_end();
245
+ $value .= $this->get_td_start();
246
+ }
247
+
248
+ $value .= '<input type="text" id="' . $args['name'] . '" name="' . $args['namearray'] . '[' . $args['name'] . ']" value="' . $args['textvalue'] . '"';
249
+
250
+ if ( $args['maxlength'] ) {
251
+ $value .= ' ' . $this->get_maxlength( $args['maxlength'] );
252
+ }
253
+
254
+ if ( $args['onblur'] ) {
255
+ $value .= ' ' . $this->get_onblur( $args['onblur'] );
256
+ }
257
+
258
+ $value .= ' /><br/>';
259
+
260
+ if ( !empty( $args['aftertext'] ) )
261
+ $value .= $args['aftertext'];
262
+
263
+ if ( $args['wrap'] ) {
264
+ $value .= $this->get_td_end();
265
+ $value .= $this->get_tr_end();
266
+ }
267
+
268
+ return $value;
269
+ }
270
+
271
+ /**
272
+ * Return a <textarea> input.
273
+ *
274
+ * @since 1.0
275
+ *
276
+ * @param array $args Arguments to use with the textarea input.
277
+ *
278
+ * @return string $value Complete <textarea> input with proper attributes.
279
+ */
280
+ public function get_textarea_input( $args = array() ) {
281
+ $defaults = $this->get_default_input_parameters(
282
+ array(
283
+ 'rows' => '',
284
+ 'cols' => '',
285
+ )
286
+ );
287
+ $args = wp_parse_args( $args, $defaults );
288
+
289
+ $value = '';
290
+
291
+ if ( $args['wrap'] ) {
292
+ $value .= $this->get_tr_start();
293
+ $value .= $this->get_th_start();
294
+ $value .= $this->get_label( $args['name'], $args['labeltext'] );
295
+ if ( $args['required'] ) { $value .= $this->get_required(); }
296
+ $value .= $this->get_help( $args['helptext'] );
297
+ $value .= $this->get_th_end();
298
+ $value .= $this->get_td_start();
299
+ }
300
+
301
+ $value .= '<textarea id="' . $args['name'] . '" name="' . $args['namearray'] . '[' . $args['name'] . ']" rows="' . $args['rows'] . '" cols="' . $args['cols'] . '">' . $args['textvalue'] . '</textarea>';
302
+
303
+ if ( !empty ( $args['aftertext'] ) )
304
+ $value .= $args['aftertext'];
305
+
306
+ if ( $args['wrap'] ) {
307
+ $value .= $this->get_td_end();
308
+ $value .= $this->get_tr_end();
309
+ }
310
+
311
+ return $value;
312
+ }
313
+
314
+ /**
315
+ * Return a checkbox <input>.
316
+ *
317
+ * @since 1.0
318
+ *
319
+ * @param array $args Arguments to use with the checkbox input.
320
+ *
321
+ * @return string $value Complete checkbox <input> with proper attributes.
322
+ */
323
+ public function get_check_input( $args = array() ) {
324
+ $defaults = $this->get_default_input_parameters(
325
+ array(
326
+ 'checkvalue' => '',
327
+ 'checked' => 'true',
328
+ 'checklisttext' => '',
329
+ 'default' => false
330
+ )
331
+ );
332
+
333
+ $args = wp_parse_args( $args, $defaults );
334
+
335
+ $value = '';
336
+ if ( $args['wrap'] ) {
337
+ $value .= $this->get_tr_start();
338
+ $value .= $this->get_th_start();
339
+ $value .= $args['checklisttext'];
340
+ if ( $args['required'] ) { $value .= $this->get_required(); }
341
+ $value .= $this->get_th_end();
342
+ $value .= $this->get_td_start();
343
+ }
344
+
345
+ if ( isset( $args['checked'] ) && 'false' == $args['checked'] ) {
346
+ $value .= '<input type="checkbox" id="' . $args['name'] . '" name="' . $args['namearray'] . '[]" value="' . $args['checkvalue'] . '" />';
347
+ } else {
348
+ $value .= '<input type="checkbox" id="' . $args['name'] . '" name="' . $args['namearray'] . '[]" value="' . $args['checkvalue'] . '" checked="checked" />';
349
+ }
350
+ $value .= $this->get_label( $args['name'], $args['labeltext'] );
351
+ $value .= $this->get_help( $args['helptext'] );
352
+ $value .= '<br/>';
353
+
354
+ if ( $args['wrap'] ) {
355
+ $value .= $this->get_td_end();
356
+ $value .= $this->get_tr_end();
357
+ }
358
+
359
+ return $value;
360
+ }
361
+
362
+ /**
363
+ * Return some array_merged default arguments for all input types.
364
+ *
365
+ * @since 1.0
366
+ *
367
+ * @param array $additions Arguments array to merge with our defaults.
368
+ *
369
+ * @return array $value Merged arrays for our default parameters.
370
+ */
371
+ public function get_default_input_parameters( $additions = array() ) {
372
+ return array_merge(
373
+ array(
374
+ 'namearray' => '',
375
+ 'name' => '',
376
+ 'textvalue' => '',
377
+ 'labeltext' => '',
378
+ 'aftertext' => '',
379
+ 'helptext' => '',
380
+ 'required' => false,
381
+ 'wrap' => true
382
+ ),
383
+ (array)$additions
384
+ );
385
+ }
386
+ }
css/cptui.css ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .help {
2
+ border-radius: 50%;
3
+ display: inline-block;
4
+ height: 15px;
5
+ margin-left: 2px;
6
+ text-align: center;
7
+ width: 15px;
8
+ }
9
+ .help:hover { font-weight: bold; }
10
+ .required { color: rgb(255,0,0); }
11
+ .cptui-table #excerpt { height: 16px; margin-right: 4px; width: auto; }
12
+ .cptui-table td { vertical-align: top; width: 50%; }
13
+ #cptui_select_post_type, #cptui_select_taxonomy { margin-top: 15px; }
14
+ .cptui_post_import, .cptui_tax_import {
15
+ height: 200px;
16
+ margin-bottom: 10px;
17
+ resize: vertical;
18
+ width: 100%;
19
+ }
20
+ .cptui_post_type_get_code, .cptui_tax_get_code {
21
+ height: 300px;
22
+ resize: vertical;
23
+ width: 100%;
24
+ }
25
+ #cptui_accordion { height: 500px; }
26
+ #cptui_accordion h3:hover, .cptui-table .question:hover { cursor: pointer; }
27
+ .question { font-size: 18px; font-weight: bold; }
28
+ .answer { margin: 10px 0 0 20px; }
29
+ #support li {
30
+ position: relative;
31
+ }
32
+ #cptui_accordion h3:after, #support .question:before {
33
+ content: "\f139";
34
+ display: inline-block;
35
+ font: normal 25px/1 'dashicons';
36
+ -webkit-font-smoothing: antialiased;
37
+ }
38
+ #cptui_accordion h3.ui-state-active:after, #support .question.active:before {
39
+ content: "\f140";
40
+ }
41
+ #support .question:before {
42
+ margin-left: -25px;
43
+ position: absolute;
44
+ }
45
+ #cptui_accordion h3:after {
46
+ position: absolute;
47
+ }
48
+ #support ol li { list-style: none; }
49
+
50
+ .ui-accordion-content {
51
+ overflow: auto;
52
+ margin: 0 auto;
53
+
54
+ background:
55
+ /* Shadow covers */
56
+ linear-gradient(#F1F1F1 30%, rgba(255,255,255,0)),
57
+ linear-gradient(rgba(255,255,255,0), #F1F1F1 70%) 0 100%,
58
+
59
+ /* Shadows */
60
+ radial-gradient(50% 0, farthest-side, rgba(0,0,0,.3), rgba(0,0,0,0)),
61
+ radial-gradient(50% 100%,farthest-side, rgba(0,0,0,.3), rgba(0,0,0,0)) 0 100%;
62
+ background:
63
+ /* Shadow covers */
64
+ linear-gradient(#F1F1F1 30%, rgba(255,255,255,0)),
65
+ linear-gradient(rgba(255,255,255,0), #F1F1F1 70%) 0 100%,
66
+
67
+ /* Shadows */
68
+ radial-gradient(farthest-side at 50% 0, rgba(0,0,0,.3), rgba(0,0,0,0)),
69
+ radial-gradient(farthest-side at 50% 100%, rgba(0,0,0,.3), rgba(0,0,0,0)) 0 100%;
70
+ background-repeat: no-repeat;
71
+ background-size: 100% 40px, 100% 40px, 100% 14px, 100% 14px;
72
+
73
+ /* Opera doesn't support this in the shorthand */
74
+ background-attachment: local, local, scroll, scroll;
75
+ }
76
+ .one-third {
77
+ width: 33%;
78
+ }
79
+ .valign {
80
+ vertical-align: top;
81
+ }
custom-post-type-ui.php CHANGED
@@ -1,1721 +1,649 @@
1
  <?php
2
  /*
3
  Plugin Name: Custom Post Type UI
4
- Plugin URI: http://webdevstudios.com/plugin/custom-post-type-ui/
5
  Description: Admin panel for creating custom post types and custom taxonomies in WordPress
6
  Author: WebDevStudios.com
7
- Version: 0.8.5
8
  Author URI: http://webdevstudios.com/
9
  Text Domain: cpt-plugin
10
  License: GPLv2
11
  */
12
 
13
- // Define current version constant
14
- define( 'CPT_VERSION', '0.8.5' );
 
 
15
 
16
- // Define current WordPress version constant
17
  define( 'CPTUI_WP_VERSION', get_bloginfo( 'version' ) );
18
 
19
- // Define plugin URL constant
20
- $CPT_URL = cpt_check_return( 'add' );
21
-
22
- //load translated strings
23
- add_action( 'init', 'cpt_load_textdomain' );
24
-
25
- // create custom plugin settings menu
26
- add_action( 'admin_menu', 'cpt_plugin_menu' );
27
-
28
- //call delete post function
29
- add_action( 'admin_init', 'cpt_delete_post_type' );
30
-
31
- //call register settings function
32
- add_action( 'admin_init', 'cpt_register_settings' );
33
-
34
- //process custom taxonomies if they exist
35
- add_action( 'init', 'cpt_create_custom_taxonomies', 0 );
36
-
37
- //process custom taxonomies if they exist
38
- add_action( 'init', 'cpt_create_custom_post_types', 0 );
39
-
40
- add_action( 'admin_head', 'cpt_help_style' );
41
-
42
- //flush rewrite rules on deactivation
43
- register_deactivation_hook( __FILE__, 'cpt_deactivation' );
44
-
45
- function cpt_deactivation() {
46
- // Clear the permalinks to remove our post type's rules
47
  flush_rewrite_rules();
48
  }
49
-
50
- function cpt_load_textdomain() {
 
 
 
 
 
 
51
  load_plugin_textdomain( 'cpt-plugin', false, basename( dirname( __FILE__ ) ) . '/languages' );
52
  }
53
-
54
- function cpt_plugin_menu() {
55
- //create custom post type menu
56
- add_menu_page( __( 'Custom Post Types', 'cpt-plugin' ), __( 'CPT UI', 'cpt-plugin' ), 'manage_options', 'cpt_main_menu', 'cpt_settings' );
57
-
58
- //create submenu items
59
- add_submenu_page( 'cpt_main_menu', __( 'Add New', 'cpt-plugin' ), __( 'Add New', 'cpt-plugin' ), 'manage_options', 'cpt_sub_add_new', 'cpt_add_new' );
60
- add_submenu_page( 'cpt_main_menu', __( 'Manage Post Types', 'cpt-plugin' ), __( 'Manage Post Types', 'cpt-plugin' ), 'manage_options', 'cpt_sub_manage_cpt', 'cpt_manage_cpt' );
61
- add_submenu_page( 'cpt_main_menu', __( 'Manage Taxonomies', 'cpt-plugin' ), __( 'Manage Taxonomies', 'cpt-plugin' ), 'manage_options', 'cpt_sub_manage_taxonomies', 'cpt_manage_taxonomies' );
62
  }
63
-
64
- //temp fix, should do: http://planetozh.com/blog/2008/04/how-to-load-javascript-with-your-wordpress-plugin/
65
- //only load JS if on a CPT page
66
- if ( strpos( $_SERVER['REQUEST_URI'], 'cpt' ) > 0 ) {
67
- add_action( 'admin_head', 'cpt_wp_add_styles' );
 
 
 
 
 
 
 
68
  }
 
69
 
70
- // Add JS Scripts
71
- function cpt_wp_add_styles() {
72
-
73
- wp_enqueue_script( 'jquery' ); ?>
74
-
75
- <script type="text/javascript" >
76
- jQuery(document).ready(function($) {
77
- $(".comment_button").click(function() {
78
- var element = $(this), I = element.attr("id");
79
- $("#slidepanel"+I).slideToggle(300);
80
- $(this).toggleClass("active");
81
-
82
- return false;
83
- });
84
- });
85
- </script>
86
- <?php
87
  }
88
-
89
- function cpt_create_custom_post_types() {
90
- //register custom post types
91
- $cpt_post_types = get_option('cpt_custom_post_types');
92
-
93
- //check if option value is an Array before proceeding
94
- if ( is_array( $cpt_post_types ) ) {
95
- foreach ($cpt_post_types as $cpt_post_type) {
96
- //set post type values
97
- $cpt_label = ( !empty( $cpt_post_type["label"] ) ) ? esc_html( $cpt_post_type["label"] ) : esc_html( $cpt_post_type["name"] ) ;
98
- $cpt_singular = ( !empty( $cpt_post_type["singular_label"] ) ) ? esc_html( $cpt_post_type["singular_label"] ) : esc_html( $cpt_label );
99
- $cpt_rewrite_slug = ( !empty( $cpt_post_type["rewrite_slug"] ) ) ? esc_html( $cpt_post_type["rewrite_slug"] ) : esc_html( $cpt_post_type["name"] );
100
- $cpt_rewrite_withfront = ( !empty( $cpt_post_type["rewrite_withfront"] ) ) ? true : get_disp_boolean( $cpt_post_type["rewrite_withfront"] ); //reversed because false is empty
101
- $cpt_menu_position = ( !empty( $cpt_post_type["menu_position"] ) ) ? intval( $cpt_post_type["menu_position"] ) : null; //must be null
102
- $cpt_menu_icon = ( !empty( $cpt_post_type["menu_icon"] ) ) ? esc_attr( $cpt_post_type["menu_icon"] ) : null; //must be null
103
- $cpt_taxonomies = ( !empty( $cpt_post_type[1] ) ) ? $cpt_post_type[1] : array();
104
- $cpt_supports = ( !empty( $cpt_post_type[0] ) ) ? $cpt_post_type[0] : array();
105
-
106
- //Show UI must be true
107
- if ( true == get_disp_boolean( $cpt_post_type["show_ui"] ) ) {
108
- //If the string is empty, we will need boolean, else use the string.
109
- if ( empty( $cpt_post_type['show_in_menu_string'] ) ) {
110
- $cpt_show_in_menu = ( $cpt_post_type["show_in_menu"] == 1 ) ? true : false;
111
- } else {
112
- $cpt_show_in_menu = $cpt_post_type['show_in_menu_string'];
113
- }
114
- } else {
115
- $cpt_show_in_menu = false;
116
- }
117
-
118
- //set custom label values
119
- $cpt_labels['name'] = $cpt_label;
120
- $cpt_labels['singular_name'] = $cpt_post_type["singular_label"];
121
-
122
- if ( isset ( $cpt_post_type[2]["menu_name"] ) ) {
123
- $cpt_labels['menu_name'] = ( !empty( $cpt_post_type[2]["menu_name"] ) ) ? $cpt_post_type[2]["menu_name"] : $cpt_label;
124
- }
125
-
126
- $cpt_has_archive = ( !empty( $cpt_post_type["has_archive"] ) ) ? get_disp_boolean( $cpt_post_type["has_archive"] ) : '';
127
- $cpt_exclude_from_search = ( !empty( $cpt_post_type["exclude_from_search"] ) ) ? get_disp_boolean( $cpt_post_type["exclude_from_search"] ) : '';
128
- $cpt_labels['add_new'] = ( !empty( $cpt_post_type[2]["add_new"] ) ) ? $cpt_post_type[2]["add_new"] : 'Add ' .$cpt_singular;
129
- $cpt_labels['add_new_item'] = ( !empty( $cpt_post_type[2]["add_new_item"] ) ) ? $cpt_post_type[2]["add_new_item"] : 'Add New ' .$cpt_singular;
130
- $cpt_labels['edit'] = ( !empty( $cpt_post_type[2]["edit"] ) ) ? $cpt_post_type[2]["edit"] : 'Edit';
131
- $cpt_labels['edit_item'] = ( !empty( $cpt_post_type[2]["edit_item"] ) ) ? $cpt_post_type[2]["edit_item"] : 'Edit ' .$cpt_singular;
132
- $cpt_labels['new_item'] = ( !empty( $cpt_post_type[2]["new_item"] ) ) ? $cpt_post_type[2]["new_item"] : 'New ' .$cpt_singular;
133
- $cpt_labels['view'] = ( !empty( $cpt_post_type[2]["view"] ) ) ? $cpt_post_type[2]["view"] : 'View ' .$cpt_singular;
134
- $cpt_labels['view_item'] = ( !empty( $cpt_post_type[2]["view_item"] ) ) ? $cpt_post_type[2]["view_item"] : 'View ' .$cpt_singular;
135
- $cpt_labels['search_items'] = ( !empty( $cpt_post_type[2]["search_items"] ) ) ? $cpt_post_type[2]["search_items"] : 'Search ' .$cpt_label;
136
- $cpt_labels['not_found'] = ( !empty( $cpt_post_type[2]["not_found"] ) ) ? $cpt_post_type[2]["not_found"] : 'No ' .$cpt_label. ' Found';
137
- $cpt_labels['not_found_in_trash'] = ( !empty( $cpt_post_type[2]["not_found_in_trash"] ) ) ? $cpt_post_type[2]["not_found_in_trash"] : 'No ' .$cpt_label. ' Found in Trash';
138
- $cpt_labels['parent'] = ( $cpt_post_type[2]["parent"] ) ? $cpt_post_type[2]["parent"] : 'Parent ' .$cpt_singular;
139
-
140
- register_post_type( $cpt_post_type["name"], array( 'label' => __($cpt_label),
141
- 'public' => get_disp_boolean($cpt_post_type["public"]),
142
- 'singular_label' => $cpt_post_type["singular_label"],
143
- 'show_ui' => get_disp_boolean($cpt_post_type["show_ui"]),
144
- 'has_archive' => $cpt_has_archive,
145
- 'show_in_menu' => $cpt_show_in_menu,
146
- 'capability_type' => $cpt_post_type["capability_type"],
147
- 'map_meta_cap' => true,
148
- 'hierarchical' => get_disp_boolean($cpt_post_type["hierarchical"]),
149
- 'exclude_from_search' => $cpt_exclude_from_search,
150
- 'rewrite' => array( 'slug' => $cpt_rewrite_slug, 'with_front' => $cpt_rewrite_withfront ),
151
- 'query_var' => get_disp_boolean($cpt_post_type["query_var"]),
152
- 'description' => esc_html($cpt_post_type["description"]),
153
- 'menu_position' => $cpt_menu_position,
154
- 'menu_icon' => $cpt_menu_icon,
155
- 'supports' => $cpt_supports,
156
- 'taxonomies' => $cpt_taxonomies,
157
- 'labels' => $cpt_labels
158
- ) );
159
  }
160
  }
 
161
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
 
163
-
164
- function cpt_create_custom_taxonomies() {
165
- //register custom taxonomies
166
- $cpt_tax_types = get_option('cpt_custom_tax_types');
167
-
168
- //check if option value is an array before proceeding
169
- if ( is_array( $cpt_tax_types ) ) {
170
- foreach ($cpt_tax_types as $cpt_tax_type) {
171
-
172
- //set custom taxonomy values
173
- $cpt_label = ( !empty( $cpt_tax_type["label"] ) ) ? esc_html( $cpt_tax_type["label"] ) : esc_html( $cpt_tax_type["name"] );
174
- $cpt_singular_label = ( !empty( $cpt_tax_type["singular_label"] ) ) ? esc_html( $cpt_tax_type["singular_label"] ) : esc_html( $cpt_tax_type["name"] );
175
- $cpt_rewrite_slug = ( !empty( $cpt_tax_type["rewrite_slug"] ) ) ? esc_html( $cpt_tax_type["rewrite_slug"] ) : esc_html( $cpt_tax_type["name"] );
176
- $cpt_tax_show_admin_column = ( !empty( $cpt_tax_type["show_admin_column"] ) ) ? esc_html( $cpt_tax_type["show_admin_column"] ) : false;
177
- $cpt_post_types = ( !empty( $cpt_tax_type[1] ) ) ? $cpt_tax_type[1] : $cpt_tax_type["cpt_name"];
178
-
179
- //set custom label values
180
- $cpt_labels['name'] = $cpt_label;
181
- $cpt_labels['singular_name'] = $cpt_tax_type["singular_label"];
182
- $cpt_labels['search_items'] = ( $cpt_tax_type[0]["search_items"] ) ? $cpt_tax_type[0]["search_items"] : 'Search ' .$cpt_label;
183
- $cpt_labels['popular_items'] = ( $cpt_tax_type[0]["popular_items"] ) ? $cpt_tax_type[0]["popular_items"] : 'Popular ' .$cpt_label;
184
- $cpt_labels['all_items'] = ( $cpt_tax_type[0]["all_items"] ) ? $cpt_tax_type[0]["all_items"] : 'All ' .$cpt_label;
185
- $cpt_labels['parent_item'] = ( $cpt_tax_type[0]["parent_item"] ) ? $cpt_tax_type[0]["parent_item"] : 'Parent ' .$cpt_singular_label;
186
- $cpt_labels['parent_item_colon'] = ( $cpt_tax_type[0]["parent_item_colon"] ) ? $cpt_tax_type[0]["parent_item_colon"] : 'Parent ' .$cpt_singular_label. ':';
187
- $cpt_labels['edit_item'] = ( $cpt_tax_type[0]["edit_item"] ) ? $cpt_tax_type[0]["edit_item"] : 'Edit ' .$cpt_singular_label;
188
- $cpt_labels['update_item'] = ( $cpt_tax_type[0]["update_item"] ) ? $cpt_tax_type[0]["update_item"] : 'Update ' .$cpt_singular_label;
189
- $cpt_labels['add_new_item'] = ( $cpt_tax_type[0]["add_new_item"] ) ? $cpt_tax_type[0]["add_new_item"] : 'Add New ' .$cpt_singular_label;
190
- $cpt_labels['new_item_name'] = ( $cpt_tax_type[0]["new_item_name"] ) ? $cpt_tax_type[0]["new_item_name"] : 'New ' .$cpt_singular_label. ' Name';
191
- $cpt_labels['separate_items_with_commas'] = ( $cpt_tax_type[0]["separate_items_with_commas"] ) ? $cpt_tax_type[0]["separate_items_with_commas"] : 'Separate ' .$cpt_label. ' with commas';
192
- $cpt_labels['add_or_remove_items'] = ( $cpt_tax_type[0]["add_or_remove_items"] ) ? $cpt_tax_type[0]["add_or_remove_items"] : 'Add or remove ' .$cpt_label;
193
- $cpt_labels['choose_from_most_used'] = ( $cpt_tax_type[0]["choose_from_most_used"] ) ? $cpt_tax_type[0]["choose_from_most_used"] : 'Choose from the most used ' .$cpt_label;
194
-
195
- //register our custom taxonomies
196
- register_taxonomy( $cpt_tax_type["name"],
197
- $cpt_post_types,
198
- array( 'hierarchical' => get_disp_boolean($cpt_tax_type["hierarchical"]),
199
- 'label' => $cpt_label,
200
- 'show_ui' => get_disp_boolean($cpt_tax_type["show_ui"]),
201
- 'query_var' => get_disp_boolean($cpt_tax_type["query_var"]),
202
- 'rewrite' => array('slug' => $cpt_rewrite_slug),
203
- 'singular_label' => $cpt_singular_label,
204
- 'labels' => $cpt_labels,
205
- 'show_admin_column' => $cpt_tax_show_admin_column
206
- ) );
207
-
208
- }
209
  }
210
- }
211
-
212
- //delete custom post type or custom taxonomy
213
- function cpt_delete_post_type() {
214
- global $CPT_URL;
215
 
216
- //check if we are deleting a custom post type
217
- if( isset( $_GET['deltype'] ) ) {
218
-
219
- //nonce security check
220
- check_admin_referer( 'cpt_delete_post_type' );
221
-
222
- $delType = intval( $_GET['deltype'] );
223
- $cpt_post_types = get_option( 'cpt_custom_post_types' );
224
-
225
- unset( $cpt_post_types[$delType] );
226
-
227
- $cpt_post_types = array_values( $cpt_post_types );
228
-
229
- update_option( 'cpt_custom_post_types', $cpt_post_types );
230
-
231
- if ( isset( $_GET['return'] ) ) {
232
- $RETURN_URL = cpt_check_return( esc_attr( $_GET['return'] ) );
233
- } else {
234
- $RETURN_URL = $CPT_URL;
235
- }
236
-
237
- wp_redirect( $RETURN_URL .'&cpt_msg=del' );
238
  }
239
 
240
- //check if we are deleting a custom taxonomy
241
- if( isset( $_GET['deltax'] ) ) {
242
- check_admin_referer( 'cpt_delete_tax' );
243
-
244
- $delType = intval( $_GET['deltax'] );
245
- $cpt_taxonomies = get_option( 'cpt_custom_tax_types' );
246
-
247
- unset( $cpt_taxonomies[$delType] );
248
-
249
- $cpt_taxonomies = array_values( $cpt_taxonomies );
250
-
251
- update_option( 'cpt_custom_tax_types', $cpt_taxonomies );
252
 
253
- if ( isset( $_GET['return'] ) ) {
254
- $RETURN_URL = cpt_check_return( esc_attr( $_GET['return'] ) );
255
- } else {
256
- $RETURN_URL = $CPT_URL;
257
  }
258
-
259
- wp_redirect( $RETURN_URL .'&cpt_msg=del' );
260
  }
261
 
262
- }
263
-
264
- function cpt_register_settings() {
265
- global $cpt_error, $CPT_URL;
266
-
267
- if ( isset( $_POST['cpt_edit'] ) ) {
268
- //edit a custom post type
269
- check_admin_referer( 'cpt_add_custom_post_type' );
270
-
271
- //custom post type to edit
272
- $cpt_edit = intval( $_POST['cpt_edit'] );
273
-
274
- //edit the custom post type
275
- $cpt_form_fields = $_POST['cpt_custom_post_type'];
276
-
277
- //add support checkbox values to array
278
- $cpt_supports = ( isset( $_POST['cpt_supports'] ) ) ? $_POST['cpt_supports'] : null;
279
- array_push($cpt_form_fields, $cpt_supports);
280
-
281
- //add taxonomies support checkbox values to array
282
- $cpt_addon_taxes = ( isset( $_POST['cpt_addon_taxes'] ) ) ? $_POST['cpt_addon_taxes'] : null;
283
- array_push( $cpt_form_fields, $cpt_addon_taxes );
284
-
285
- //add label values to array
286
- array_push( $cpt_form_fields, $_POST['cpt_labels'] );
287
-
288
- //load custom posts saved in WP
289
- $cpt_options = get_option( 'cpt_custom_post_types' );
290
-
291
- if ( is_array( $cpt_options ) ) {
292
-
293
- unset( $cpt_options[$cpt_edit] );
294
-
295
- //insert new custom post type into the array
296
- array_push( $cpt_options, $cpt_form_fields );
297
-
298
- $cpt_options = array_values( $cpt_options );
299
- $cpt_options = stripslashes_deep( $cpt_options );
300
-
301
- //save custom post types
302
- update_option( 'cpt_custom_post_types', $cpt_options );
303
-
304
- if ( isset( $_GET['return'] ) ) {
305
- $RETURN_URL = cpt_check_return( esc_attr( $_GET['return'] ) );
306
- } else {
307
- $RETURN_URL = $CPT_URL;
308
- }
309
-
310
- wp_redirect( $RETURN_URL );
311
-
312
- }
313
-
314
- } elseif ( isset( $_POST['cpt_submit'] ) ) {
315
- //create a new custom post type
316
-
317
- //nonce security check
318
- check_admin_referer( 'cpt_add_custom_post_type' );
319
-
320
- //retrieve new custom post type values
321
- $cpt_form_fields = $_POST['cpt_custom_post_type'];
322
-
323
- if ( empty( $cpt_form_fields["name"] ) ) {
324
- if ( isset( $_GET['return'] ) ) {
325
- $RETURN_URL = cpt_check_return( esc_attr( $_GET['return'] ) );
326
- } else {
327
- $RETURN_URL = $CPT_URL;
328
- }
329
-
330
- wp_redirect( $RETURN_URL .'&cpt_error=1' );
331
- exit();
332
- }
333
- if ( false !== strpos( $cpt_form_fields["name"], '\'' ) ||
334
- false !== strpos( $cpt_form_fields["name"], '\"' ) ||
335
- false !== strpos( $cpt_form_fields["rewrite_slug"], '\'' ) ||
336
- false !== strpos( $cpt_form_fields["rewrite_slug"], '\"' ) ) {
337
- if ( isset( $_GET['return'] ) ) {
338
- $RETURN_URL = cpt_check_return( esc_attr( $_GET['return'] ) );
339
- } else {
340
- $RETURN_URL = $CPT_URL;
341
- }
342
-
343
- wp_redirect( $RETURN_URL .'&cpt_error=4' );
344
- exit();
345
- }
346
-
347
- //add support checkbox values to array
348
- $cpt_supports = ( isset( $_POST['cpt_supports'] ) ) ? $_POST['cpt_supports'] : null;
349
- array_push( $cpt_form_fields, $cpt_supports );
350
-
351
- //add taxonomies support checkbox values to array
352
- $cpt_addon_taxes = ( isset( $_POST['cpt_addon_taxes'] ) ) ? $_POST['cpt_addon_taxes'] : null;
353
- array_push( $cpt_form_fields, $cpt_addon_taxes );
354
-
355
- //add label values to array
356
- array_push( $cpt_form_fields, $_POST['cpt_labels'] );
357
-
358
- //load custom posts saved in WP
359
- $cpt_options = get_option( 'cpt_custom_post_types' );
360
 
361
- //check if option exists, if not create an array for it
362
- if ( !is_array( $cpt_options ) ) {
363
- $cpt_options = array();
 
 
364
  }
365
 
366
- //insert new custom post type into the array
367
- array_push( $cpt_options, $cpt_form_fields );
368
- $cpt_options = stripslashes_deep( $cpt_options );
369
-
370
- //save new custom post type array in the CPT option
371
- update_option( 'cpt_custom_post_types', $cpt_options );
372
-
373
- if ( isset( $_GET['return'] ) ) {
374
- $RETURN_URL = cpt_check_return( esc_attr( $_GET['return'] ) );
375
- } else {
376
- $RETURN_URL = $CPT_URL;
377
  }
378
-
379
- wp_redirect( $RETURN_URL .'&cpt_msg=1' );
380
  }
381
 
382
- if ( isset( $_POST['cpt_edit_tax'] ) ) {
383
- //edit a custom taxonomy
384
-
385
- //nonce security check
386
- check_admin_referer( 'cpt_add_custom_taxonomy' );
387
-
388
- //custom taxonomy to edit
389
- $cpt_edit = intval( $_POST['cpt_edit_tax'] );
390
-
391
- //edit the custom taxonomy
392
- $cpt_form_fields = $_POST['cpt_custom_tax'];
393
-
394
- //add label values to array
395
- array_push( $cpt_form_fields, $_POST['cpt_tax_labels'] );
396
-
397
- //add attached post type values to array
398
- array_push( $cpt_form_fields, $_POST['cpt_post_types'] );
399
-
400
- //load custom posts saved in WP
401
- $cpt_options = get_option( 'cpt_custom_tax_types' );
402
-
403
- if ( is_array( $cpt_options ) ) {
404
-
405
- unset( $cpt_options[$cpt_edit] );
406
-
407
- //insert new custom post type into the array
408
- array_push( $cpt_options, $cpt_form_fields );
409
-
410
- $cpt_options = array_values( $cpt_options );
411
-
412
- //save custom post types
413
- update_option( 'cpt_custom_tax_types', $cpt_options );
414
-
415
- if ( isset( $_GET['return'] ) ) {
416
- $RETURN_URL = cpt_check_return( esc_attr( $_GET['return'] ) );
417
- } else {
418
- $RETURN_URL = $CPT_URL;
419
- }
420
 
421
- wp_redirect( $RETURN_URL );
 
422
 
 
 
 
 
 
 
 
 
 
 
 
423
  }
424
-
425
- } elseif ( isset( $_POST['cpt_add_tax'] ) ) {
426
- //create new custom taxonomy
427
-
428
- //nonce security check
429
- check_admin_referer( 'cpt_add_custom_taxonomy' );
430
-
431
- //retrieve new custom taxonomy values
432
- $cpt_form_fields = $_POST['cpt_custom_tax'];
433
-
434
- //verify required fields are filled out
435
- if ( empty( $cpt_form_fields["name"] ) ) {
436
- if ( isset( $_GET['return'] ) ) {
437
- $RETURN_URL = cpt_check_return( esc_attr( $_GET['return'] ) );
438
- } else {
439
- $RETURN_URL = $CPT_URL;
440
- }
441
-
442
- wp_redirect( $RETURN_URL .'&cpt_error=2' );
443
- exit();
444
- } elseif ( empty( $_POST['cpt_post_types'] ) ) {
445
- if ( isset( $_GET['return'] ) ) {
446
- $RETURN_URL = cpt_check_return( esc_attr( $_GET['return'] ) );
447
- } else {
448
- $RETURN_URL = $CPT_URL;
449
- }
450
-
451
- wp_redirect( $RETURN_URL .'&cpt_error=3' );
452
- exit();
453
  }
 
454
 
455
- if ( false !== strpos( $cpt_form_fields["name"], '\'' ) ||
456
- false !== strpos( $cpt_form_fields["name"], '\"' ) ||
457
- false !== strpos( $cpt_form_fields["rewrite_slug"], '\'' ) ||
458
- false !== strpos( $cpt_form_fields["rewrite_slug"], '\"' ) ) {
459
- if ( isset( $_GET['return'] ) ) {
460
- $RETURN_URL = cpt_check_return( esc_attr( $_GET['return'] ) );
461
- } else {
462
- $RETURN_URL = $CPT_URL;
463
- }
464
-
465
- wp_redirect( $RETURN_URL .'&cpt_error=5' );
466
- exit();
467
  }
468
 
469
- //add label values to array
470
- array_push( $cpt_form_fields, $_POST['cpt_tax_labels'] );
471
-
472
- //add attached post type values to array
473
- array_push( $cpt_form_fields, $_POST['cpt_post_types'] );
474
-
475
- //load custom taxonomies saved in WP
476
- $cpt_options = get_option( 'cpt_custom_tax_types' );
477
-
478
- //check if option exists, if not create an array for it
479
- if ( !is_array( $cpt_options ) ) {
480
- $cpt_options = array();
481
  }
482
 
483
- //insert new custom taxonomy into the array
484
- array_push( $cpt_options, $cpt_form_fields );
485
-
486
- //save new custom taxonomy array in the CPT option
487
- update_option( 'cpt_custom_tax_types', $cpt_options );
488
-
489
- if ( isset( $_GET['return'] ) ) {
490
- $RETURN_URL = cpt_check_return( esc_attr( $_GET['return'] ) );
491
- } else {
492
- $RETURN_URL = $CPT_URL;
493
  }
 
494
 
495
- wp_redirect( $RETURN_URL .'&cpt_msg=2' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
496
 
497
- }
498
  }
499
 
500
- //main welcome/settings page
501
- function cpt_settings() {
502
- global $CPT_URL, $wp_post_types;
503
-
504
- //flush rewrite rules
505
- flush_rewrite_rules();
506
- ?>
 
507
  <div class="wrap">
508
- <?php screen_icon( 'plugins' ); ?>
509
- <h2><?php _e( 'Custom Post Type UI', 'cpt-plugin' ); ?> <?php _e( 'version', 'cpt-plugin' ); ?>: <?php echo CPT_VERSION; ?></h2>
510
-
511
- <h2><?php _e( 'Frequently Asked Questions', 'cpt-plugin' ); ?></h2>
512
- <p><?php _e( 'Please note that this plugin will NOT handle display of registered post types or taxonomies in your current theme. It will simply register them for you.', 'cpt-plugin' ); ?>
513
- <h3><?php _e( 'Q: <strong>How can I display content from a custom post type on my website?</strong>', 'cpt-plugin' ); ?></h3>
514
- <p>
515
- <?php _e( 'A: Justin Tadlock has written some great posts on the topic:', 'cpt-plugin' ); ?><br />
516
- <a href="http://justintadlock.com/archives/2010/02/02/showing-custom-post-types-on-your-home-blog-page" target="_blank"><?php _e( 'Showing Custom Post Types on your Home Page', 'cpt-plugin' ); ?></a><br />
517
- <a href="http://justintadlock.com/archives/2010/04/29/custom-post-types-in-wordpress" target="_blank"><?php _e( 'Custom Post Types in WordPress', 'cpt-plugin' ); ?></a>
518
- </p>
519
- <h3><?php _e( 'Q: <strong>How can I add custom meta boxes to my custom post types?</strong>', 'cpt-plugin' ); ?></h3>
520
- <p><?php _e( 'A: The More Fields plugin does a great job at creating custom meta boxes and fully supports custom post types: ', 'cpt-plugin' ); ?><a href="http://wordpress.org/extend/plugins/more-fields/" target="_blank">http://wordpress.org/extend/plugins/more-fields/</a>. The <a href="https://github.com/jaredatch/Custom-Metaboxes-and-Fields-for-WordPress" target="_blank">Custom Metaboxes and Fields for WordPress</a> class is a great alternative to a plugin for more advanced users.</p>
521
- <h3><?php _e( 'Q: <strong>I changed my custom post type name and now I can\'t get to my posts</strong>', 'cpt-plugin' ); ?></h3>
522
- <p><?php _e( 'A: You can either change the custom post type name back to the original name or try the Post Type Switcher plugin: ', 'cpt-plugin' ); ?><a href="http://wordpress.org/extend/plugins/post-type-switcher/" target="_blank">http://wordpress.org/extend/plugins/post-type-switcher/</a></p>
523
- <div class="cp-rss-widget">
524
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
525
  <table border="0">
526
  <tr>
527
- <td colspan="3"><h2><?php _e( 'Help Support This Plugin!', 'cpt-plugin' ); ?></h2></td>
528
- </tr>
529
- <tr>
530
- <td width="33%"><h3><?php _e( 'PayPal Donation', 'cpt-plugin' ); ?></h3></td>
531
- <td width="33%"><h3><?php _e( 'Professional WordPress<br />Second Edition', 'cpt-plugin' ); ?></h3></td>
532
- <td width="33%"><h3><?php _e( 'Professional WordPress<br />Plugin Development', 'cpt-plugin' ); ?></h3></td>
533
  </tr>
534
  <tr>
535
- <td valign="top" width="33%">
536
- <p><?php _e( 'Please donate to the development<br />of Custom Post Type UI:', 'cpt-plugin'); ?>
537
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
538
- <input type="hidden" name="cmd" value="_s-xclick">
539
- <input type="hidden" name="hosted_button_id" value="YJEDXPHE49Q3U">
540
- <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
541
- <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
542
- </form>
543
- </p>
544
- </td>
545
- <td valign="top" width="33%"><a href="http://bit.ly/prowp2" target="_blank"><img src="<?php echo plugins_url( '/images/professional-wordpress-secondedition.jpg', __FILE__ ); ?>" width="200"></a><br /><?php _e( 'The leading book on WordPress design and development!<br /><strong>Brand new second edition!', 'cpt-plugin'); ?></strong></td>
546
- <td valign="top" width="33%"><a href="http://amzn.to/plugindevbook" target="_blank"><img src="<?php echo plugins_url( '/images/professional-wordpress-plugin-development.png', __FILE__ ); ?>" width="200"></a><br /><?php _e( 'Highest rated WordPress development book on Amazon!', 'cpt-plugin' ); ?></td>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
547
  </tr>
548
  </table>
549
- <h2><?php _e( 'WebDevStudios.com Recent News', 'cpt-plugin' ); ?></h2>
550
  <?php
 
 
 
 
 
 
551
 
552
- wp_widget_rss_output( array(
553
- 'url' => esc_url( 'http://webdevstudios.com/feed/' ),
554
- 'title' => __( 'WebDevStudios.com News', 'cpt-plugin' ),
555
- 'items' => 3,
556
- 'show_summary' => 1,
557
- 'show_author' => 0,
558
- 'show_date' => 1
559
- ) );
560
- ?>
561
- </div>
562
  </div>
563
- <?php
564
- //load footer
565
- cpt_footer();
566
  }
567
 
568
- //manage custom post types page
569
- function cpt_manage_cpt() {
570
- global $CPT_URL;
 
 
 
 
 
 
 
 
 
 
 
 
 
571
 
572
- $MANAGE_URL = cpt_check_return( 'add' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
573
 
574
- ?>
575
- <div class="wrap">
576
- <?php
577
- //check for success/error messages
578
- if ( isset($_GET['cpt_msg'] ) && $_GET['cpt_msg'] == 'del' ) { ?>
579
- <div id="message" class="updated">
580
- <?php _e('Custom post type deleted successfully', 'cpt-plugin'); ?>
581
- </div>
582
- <?php
583
  }
584
- ?>
585
- <?php screen_icon( 'plugins' ); ?>
586
- <h2><?php _e('Manage Custom Post Types', 'cpt-plugin') ?></h2>
587
- <p><?php _e('Deleting custom post types will <strong>NOT</strong> delete any content into the database or added to those post types. You can easily recreate your post types and the content will still exist.', 'cpt-plugin') ?></p>
588
- <?php
589
- $cpt_post_types = get_option( 'cpt_custom_post_types', array() );
590
-
591
- if (is_array($cpt_post_types)) {
592
- ?>
593
- <table width="100%" class="widefat">
594
- <thead>
595
- <tr>
596
- <th><?php _e('Action', 'cpt-plugin');?></th>
597
- <th><?php _e('Name', 'cpt-plugin');?></th>
598
- <th><?php _e('Label', 'cpt-plugin');?></th>
599
- <th><?php _e('Public', 'cpt-plugin');?></th>
600
- <th><?php _e('Show UI', 'cpt-plugin');?></th>
601
- <th><?php _e('Hierarchical', 'cpt-plugin');?></th>
602
- <th><?php _e('Rewrite', 'cpt-plugin');?></th>
603
- <th><?php _e('Rewrite Slug', 'cpt-plugin');?></th>
604
- <th><?php _e('Total Published', 'cpt-plugin');?></th>
605
- <th><?php _e('Total Drafts', 'cpt-plugin');?></th>
606
- <th><?php _e('Supports', 'cpt-plugin');?></th>
607
- </tr>
608
- </thead>
609
- <tfoot>
610
- <tr>
611
- <th><?php _e('Action', 'cpt-plugin');?></th>
612
- <th><?php _e('Name', 'cpt-plugin');?></th>
613
- <th><?php _e('Label', 'cpt-plugin');?></th>
614
- <th><?php _e('Public', 'cpt-plugin');?></th>
615
- <th><?php _e('Show UI', 'cpt-plugin');?></th>
616
- <th><?php _e('Hierarchical', 'cpt-plugin');?></th>
617
- <th><?php _e('Rewrite', 'cpt-plugin');?></th>
618
- <th><?php _e('Rewrite Slug', 'cpt-plugin');?></th>
619
- <th><?php _e('Total Published', 'cpt-plugin');?></th>
620
- <th><?php _e('Total Drafts', 'cpt-plugin');?></th>
621
- <th><?php _e('Supports', 'cpt-plugin');?></th>
622
- </tr>
623
- </tfoot>
624
- <?php
625
- $thecounter=0;
626
- $cpt_names = array();
627
- //Create urls for management
628
- foreach ( $cpt_post_types as $cpt_post_type ) {
629
- $del_url = cpt_check_return( 'cpt' ) .'&deltype=' .$thecounter .'&return=cpt';
630
- $del_url = ( function_exists('wp_nonce_url') ) ? wp_nonce_url($del_url, 'cpt_delete_post_type') : $del_url;
631
 
632
- $edit_url = $MANAGE_URL .'&edittype=' .$thecounter .'&return=cpt';
633
- $edit_url = ( function_exists('wp_nonce_url') ) ? wp_nonce_url($edit_url, 'cpt_edit_post_type') : $edit_url;
 
 
 
 
 
 
 
 
 
 
 
 
634
 
635
- $cpt_counts = wp_count_posts($cpt_post_type["name"]);
 
636
 
637
- $rewrite_slug = ( $cpt_post_type["rewrite_slug"] ) ? $cpt_post_type["rewrite_slug"] : $cpt_post_type["name"];
638
- ?>
639
- <tr>
640
- <td valign="top"><a href="<?php echo $del_url; ?>"><?php _e( 'Delete', 'cpt-plugin' ); ?></a> / <a href="<?php echo $edit_url; ?>"><?php _e( 'Edit', 'cpt-plugin' ); ?></a> / <a href="#" class="comment_button" id="<?php echo $thecounter; ?>"><?php _e( 'Get Code', 'cpt-plugin' ); ?></a></td>
641
- <td valign="top"><?php echo stripslashes($cpt_post_type["name"]); ?></td>
642
- <td valign="top"><?php echo stripslashes($cpt_post_type["label"]); ?></td>
643
- <td valign="top"><?php echo disp_boolean($cpt_post_type["public"]); ?></td>
644
- <td valign="top"><?php echo disp_boolean($cpt_post_type["show_ui"]); ?></td>
645
- <td valign="top"><?php echo disp_boolean($cpt_post_type["hierarchical"]); ?></td>
646
- <td valign="top"><?php echo disp_boolean($cpt_post_type["rewrite"]); ?></td>
647
- <td valign="top"><?php echo $rewrite_slug; ?></td>
648
- <td valign="top"><?php echo $cpt_counts->publish; ?></td>
649
- <td valign="top"><?php echo $cpt_counts->draft; ?></td>
650
- <td>
651
- <?php
652
- if (is_array($cpt_post_type[0])) {
653
- foreach ($cpt_post_type[0] as $cpt_supports) {
654
- echo $cpt_supports .'<br />';
655
- }
656
- }
657
- ?>
658
- </td>
659
- </tr>
660
- <tr>
661
- <td colspan="12">
662
- <div style="display:none;" id="slidepanel<?php echo $thecounter; ?>">
663
- <?php
664
- // Begin the display for the "Get code" feature
665
- //display register_post_type code
666
- $custom_post_type = '';
667
- $cpt_support_array = '';
668
- $cpt_tax_array = '';
669
- $cpt_sanitized_name = str_replace( '-', '_', $cpt_post_type['name'] );
670
-
671
- $cpt_label = ( empty( $cpt_post_type["label"] ) ) ? esc_html($cpt_post_type["name"]) : esc_html($cpt_post_type["label"]);
672
- $cpt_singular = ( empty( $cpt_post_type["singular_label"] ) ) ? $cpt_label : esc_html($cpt_post_type["singular_label"]);
673
- $cpt_rewrite_slug = ( empty( $cpt_post_type["rewrite_slug"] ) ) ? esc_html($cpt_post_type["name"]) : esc_html($cpt_post_type["rewrite_slug"]);
674
- $cpt_menu_position = ( empty( $cpt_post_type["menu_position"] ) ) ? null : intval($cpt_post_type["menu_position"]);
675
- $cpt_menu_icon = ( !empty( $cpt_post_type["menu_icon"] ) ) ? esc_attr($cpt_post_type["menu_icon"]) : null;
676
-
677
- if ( true == $cpt_post_type["show_ui"] ) {
678
- $cpt_show_in_menu = ( $cpt_post_type["show_in_menu"] == 1 ) ? 1 : 0;
679
- $cpt_show_in_menu = ( $cpt_post_type["show_in_menu_string"] ) ? '\''.$cpt_post_type["show_in_menu_string"].'\'' : $cpt_show_in_menu;
680
- } else {
681
- $cpt_show_in_menu = 0;
682
- }
683
- //set custom label values
684
- $cpt_labels['name'] = $cpt_label;
685
- $cpt_labels['singular_name'] = $cpt_post_type["singular_label"];
686
- $cpt_labels['menu_name'] = ( $cpt_post_type[2]["menu_name"] ) ? $cpt_post_type[2]["menu_name"] : $cpt_label;
687
- $cpt_labels['add_new'] = ( $cpt_post_type[2]["add_new"] ) ? $cpt_post_type[2]["add_new"] : 'Add ' .$cpt_singular;
688
- $cpt_labels['add_new_item'] = ( $cpt_post_type[2]["add_new_item"] ) ? $cpt_post_type[2]["add_new_item"] : 'Add New ' .$cpt_singular;
689
- $cpt_labels['edit'] = ( $cpt_post_type[2]["edit"] ) ? $cpt_post_type[2]["edit"] : 'Edit';
690
- $cpt_labels['edit_item'] = ( $cpt_post_type[2]["edit_item"] ) ? $cpt_post_type[2]["edit_item"] : 'Edit ' .$cpt_singular;
691
- $cpt_labels['new_item'] = ( $cpt_post_type[2]["new_item"] ) ? $cpt_post_type[2]["new_item"] : 'New ' .$cpt_singular;
692
- $cpt_labels['view'] = ( $cpt_post_type[2]["view"] ) ? $cpt_post_type[2]["view"] : 'View ' .$cpt_singular;
693
- $cpt_labels['view_item'] = ( $cpt_post_type[2]["view_item"] ) ? $cpt_post_type[2]["view_item"] : 'View ' .$cpt_singular;
694
- $cpt_labels['search_items'] = ( $cpt_post_type[2]["search_items"] ) ? $cpt_post_type[2]["search_items"] : 'Search ' .$cpt_label;
695
- $cpt_labels['not_found'] = ( $cpt_post_type[2]["not_found"] ) ? $cpt_post_type[2]["not_found"] : 'No ' .$cpt_label. ' Found';
696
- $cpt_labels['not_found_in_trash'] = ( $cpt_post_type[2]["not_found_in_trash"] ) ? $cpt_post_type[2]["not_found_in_trash"] : 'No ' .$cpt_label. ' Found in Trash';
697
- $cpt_labels['parent'] = ( $cpt_post_type[2]["parent"] ) ? $cpt_post_type[2]["parent"] : 'Parent ' .$cpt_singular;
698
-
699
- if( is_array( $cpt_post_type[0] ) ) {
700
- $counter = 1;
701
- $count = count( $cpt_post_type[0] );
702
- foreach ( $cpt_post_type[0] as $cpt_supports ) {
703
- //build supports variable
704
- $cpt_support_array .= '\'' . $cpt_supports . '\'';
705
- if ( $counter != $count )
706
- $cpt_support_array .= ',';
707
-
708
- $counter++;
709
- }
710
- }
711
-
712
- if( is_array( $cpt_post_type[1] ) ) {
713
- $counter = 1;
714
- $count = count( $cpt_post_type[1] );
715
- foreach ( $cpt_post_type[1] as $cpt_taxes ) {
716
- //build taxonomies variable
717
- $cpt_tax_array .= '\''.$cpt_taxes.'\'';
718
- if ( $counter != $count )
719
- $cpt_tax_array .= ',';
720
- $counter++;
721
- }
722
- }
723
- $custom_post_type = "add_action('init', 'cptui_register_my_cpt_" . $cpt_sanitized_name . "');\n";
724
- $custom_post_type .= "function cptui_register_my_cpt_" . $cpt_sanitized_name . "() {\n";
725
- $custom_post_type .= "register_post_type('" . $cpt_post_type["name"] . "', array(\n'label' => '" . $cpt_label . "',\n";
726
- $custom_post_type .= "'description' => '" . $cpt_post_type["description"] . "',\n";
727
- $custom_post_type .= "'public' => " . disp_boolean( $cpt_post_type["public"]) . ",\n";
728
- $custom_post_type .= "'show_ui' => " . disp_boolean( $cpt_post_type["show_ui"]) . ",\n";
729
- $custom_post_type .= "'show_in_menu' => " . disp_boolean( $cpt_show_in_menu) . ",\n";
730
- $custom_post_type .= "'capability_type' => '" . $cpt_post_type["capability_type"] . "',\n";
731
- $custom_post_type .= "'map_meta_cap' => " . disp_boolean( '1' ) . ",\n";
732
- $custom_post_type .= "'hierarchical' => " . disp_boolean( $cpt_post_type["hierarchical"] ) . ",\n";
733
-
734
- if ( !empty( $cpt_post_type["rewrite_slug"] ) ) {
735
- $custom_post_type .= "'rewrite' => array('slug' => '" . $cpt_post_type["rewrite_slug"] . "', 'with_front' => " . $cpt_post_type['rewrite_withfront'] . "),\n";
736
- } else {
737
- if( empty( $cpt_post_type['rewrite_withfront'] ) ) $cpt_post_type['rewrite_withfront'] = 1;
738
- $custom_post_type .= "'rewrite' => array('slug' => '" . $cpt_post_type["name"] . "', 'with_front' => " . disp_boolean( $cpt_post_type['rewrite_withfront'] ) . "),\n";
739
- }
740
-
741
- $custom_post_type .= "'query_var' => " . disp_boolean($cpt_post_type["query_var"]) . ",\n";
742
-
743
- if ( !empty( $cpt_post_type["has_archive"] ) ) {
744
- $custom_post_type .= "'has_archive' => " . disp_boolean( $cpt_post_type["has_archive"] ) . ",\n";
745
- }
746
-
747
- if ( !empty( $cpt_post_type["exclude_from_search"] ) ) {
748
- $custom_post_type .= "'exclude_from_search' => " . disp_boolean( $cpt_post_type["exclude_from_search"] ) . ",\n";
749
- }
750
-
751
- if ( !empty( $cpt_post_type["menu_position"] ) ) {
752
- $custom_post_type .= "'menu_position' => " . $cpt_post_type["menu_position"] . ",\n";
753
- }
754
-
755
- if ( !empty( $cpt_post_type["menu_icon"] ) ) {
756
- $custom_post_type .= "'menu_icon' => '" . $cpt_post_type["menu_icon"] . "',\n";
757
- }
758
-
759
- $custom_post_type .= "'supports' => array(" . $cpt_support_array . "),\n";
760
-
761
- if ( !empty( $cpt_tax_array ) ) {
762
- $custom_post_type .= "'taxonomies' => array(" . $cpt_tax_array . "),\n";
763
- }
764
-
765
- if ( !empty( $cpt_labels ) ) {
766
- $custom_post_type .= "'labels' => " . var_export( $cpt_labels, true ) . "\n";
767
- }
768
-
769
- $custom_post_type .= ") ); }";
770
- echo '<p>';
771
- _e( 'Place the below code in your themes functions.php file to manually create this custom post type.', 'cpt-plugin' ).'<br>';
772
- _e('This is a <strong>BETA</strong> feature. Please <a href="https://github.com/WebDevStudios/custom-post-type-ui">report bugs</a>.','cpt-plugin').'</p>';
773
- echo '<textarea rows="10" cols="100">' .$custom_post_type .'</textarea>';
774
-
775
- ?>
776
- </div>
777
- </td>
778
- </tr>
779
- <?php
780
- $thecounter++;
781
- $cpt_names[] = strtolower( $cpt_post_type["name"] );
782
  }
783
- $args=array(
784
- 'public' => true,
785
- '_builtin' => false
786
- );
787
- $output = 'objects'; // or objects
788
- $post_types = get_post_types( $args, $output );
789
- $cpt_first = false;
790
- if ( $post_types ) {
791
-
792
- ?></table>
793
- <h3><?php _e('Additional Custom Post Types', 'cpt-plugin') ?></h3>
794
- <p><?php _e('The custom post types below are registered in WordPress but were not created by the Custom Post Type UI Plugin.', 'cpt-plugin') ?></p>
795
- <?php
796
- foreach ( $post_types as $post_type ) {
797
- if ( !in_array( strtolower( $post_type->name ), $cpt_names ) ) {
798
- if ( isset( $cpt_first ) && !$cpt_first ) {
799
- ?>
800
- <table width="100%" class="widefat">
801
- <thead>
802
- <tr>
803
- <th><?php _e('Name', 'cpt-plugin');?></th>
804
- <th><?php _e('Label', 'cpt-plugin');?></th>
805
- <th><?php _e('Public', 'cpt-plugin');?></th>
806
- <th><?php _e('Show UI', 'cpt-plugin');?></th>
807
- <th><?php _e('Hierarchical', 'cpt-plugin');?></th>
808
- <th><?php _e('Rewrite', 'cpt-plugin');?></th>
809
- <th><?php _e('Rewrite Slug', 'cpt-plugin');?></th>
810
- <th><?php _e('Query Var', 'cpt-plugin');?></th>
811
- </tr>
812
- </thead>
813
- <tfoot>
814
- <tr>
815
- <th><?php _e('Name', 'cpt-plugin');?></th>
816
- <th><?php _e('Label', 'cpt-plugin');?></th>
817
- <th><?php _e('Public', 'cpt-plugin');?></th>
818
- <th><?php _e('Show UI', 'cpt-plugin');?></th>
819
- <th><?php _e('Hierarchical', 'cpt-plugin');?></th>
820
- <th><?php _e('Rewrite', 'cpt-plugin');?></th>
821
- <th><?php _e('Rewrite Slug', 'cpt-plugin');?></th>
822
- <th><?php _e('Query Var', 'cpt-plugin');?></th>
823
- </tr>
824
- </tfoot>
825
- <?php
826
- $cpt_first = true;
827
- }
828
- $rewrite_slug = ( isset( $post_type->rewrite_slug ) ) ? $post_type->rewrite_slug : $post_type->name;
829
- ?>
830
- <tr>
831
- <td valign="top"><?php echo $post_type->name; ?></td>
832
- <td valign="top"><?php echo $post_type->label; ?></td>
833
- <td valign="top"><?php echo disp_boolean($post_type->public); ?></td>
834
- <td valign="top"><?php echo disp_boolean($post_type->show_ui); ?></td>
835
- <td valign="top"><?php echo disp_boolean($post_type->hierarchical); ?></td>
836
- <td valign="top"><?php echo disp_boolean($post_type->rewrite); ?></td>
837
- <td valign="top"><?php echo $rewrite_slug; ?></td>
838
- <td valign="top"><?php echo disp_boolean($post_type->query_var); ?></td>
839
- </tr>
840
- <?php
841
- }
842
- }
843
- }
844
-
845
- if ( isset($cpt_first) && !$cpt_first ) {
846
- echo '<tr><td><strong>';
847
- _e( 'No additional post types found', 'cpt-plugin' );
848
- echo '</strong></td></tr>';
849
- }
850
- ?>
851
- </table>
852
-
853
- </div><?php
854
- //load footer
855
- cpt_footer();
856
  }
857
- }
858
 
859
- //manage custom taxonomies page
860
- function cpt_manage_taxonomies() {
861
- global $CPT_URL;
862
 
863
- $MANAGE_URL = cpt_check_return( 'add' );
 
 
864
 
865
- ?>
866
- <div class="wrap">
867
- <?php
868
- //check for success/error messages
869
- if (isset($_GET['cpt_msg']) && $_GET['cpt_msg']=='del') { ?>
870
- <div id="message" class="updated">
871
- <?php _e('Custom taxonomy deleted successfully', 'cpt-plugin'); ?>
872
- </div>
873
- <?php
874
- }
875
- ?>
876
- <?php screen_icon( 'plugins' ); ?>
877
- <h2><?php _e('Manage Custom Taxonomies', 'cpt-plugin') ?></h2>
878
- <p><?php _e('Deleting custom taxonomies does <strong>NOT</strong> delete any content added to those taxonomies. You can easily recreate your taxonomies and the content will still exist.', 'cpt-plugin') ?></p>
879
- <?php
880
- $cpt_tax_types = get_option( 'cpt_custom_tax_types', array() );
881
-
882
- if (is_array($cpt_tax_types)) {
883
- ?>
884
- <table width="100%" class="widefat">
885
- <thead>
886
- <tr>
887
- <th><?php _e('Action', 'cpt-plugin');?></th>
888
- <th><?php _e('Name', 'cpt-plugin');?></th>
889
- <th><?php _e('Label', 'cpt-plugin');?></th>
890
- <th><?php _e('Singular Label', 'cpt-plugin');?></th>
891
- <th><?php _e('Attached Post Types', 'cpt-plugin');?></th>
892
- <th><?php _e('Hierarchical', 'cpt-plugin');?></th>
893
- <th><?php _e('Show UI', 'cpt-plugin');?></th>
894
- <th><?php _e('Rewrite', 'cpt-plugin');?></th>
895
- <th><?php _e('Rewrite Slug', 'cpt-plugin');?></th>
896
- </tr>
897
- </thead>
898
- <tfoot>
899
- <tr>
900
- <th><?php _e('Action', 'cpt-plugin');?></th>
901
- <th><?php _e('Name', 'cpt-plugin');?></th>
902
- <th><?php _e('Label', 'cpt-plugin');?></th>
903
- <th><?php _e('Singular Label', 'cpt-plugin');?></th>
904
- <th><?php _e('Attached Post Types', 'cpt-plugin');?></th>
905
- <th><?php _e('Hierarchical', 'cpt-plugin');?></th>
906
- <th><?php _e('Show UI', 'cpt-plugin');?></th>
907
- <th><?php _e('Rewrite', 'cpt-plugin');?></th>
908
- <th><?php _e('Rewrite Slug', 'cpt-plugin');?></th>
909
- </tr>
910
- </tfoot>
911
  <?php
912
- $thecounter=0;
913
- foreach ($cpt_tax_types as $cpt_tax_type) {
914
 
915
- $del_url = cpt_check_return( 'cpt' ) .'&deltax=' .$thecounter .'&return=tax';
916
- $del_url = ( function_exists('wp_nonce_url') ) ? wp_nonce_url($del_url, 'cpt_delete_tax') : $del_url;
917
-
918
- $edit_url = $MANAGE_URL .'&edittax=' .$thecounter .'&return=tax';
919
- $edit_url = ( function_exists('wp_nonce_url') ) ? wp_nonce_url($edit_url, 'cpt_edit_tax') : $edit_url;
920
-
921
- $rewrite_slug = ( $cpt_tax_type["rewrite_slug"] ) ? $cpt_tax_type["rewrite_slug"] : $cpt_tax_type["name"];
922
- ?>
923
- <tr>
924
- <td valign="top"><a href="<?php echo $del_url; ?>"><?php _e( 'Delete', 'cpt-plugin' ); ?></a> / <a href="<?php echo $edit_url; ?>"><?php _e( 'Edit', 'cpt-plugin' ); ?></a> / <a href="#" class="comment_button" id="<?php echo $thecounter; ?>"><?php _e( 'Get Code', 'cpt-plugin' ); ?></a></td>
925
- <td valign="top"><?php echo stripslashes($cpt_tax_type["name"]); ?></td>
926
- <td valign="top"><?php echo stripslashes($cpt_tax_type["label"]); ?></td>
927
- <td valign="top"><?php echo stripslashes($cpt_tax_type["singular_label"]); ?></td>
928
- <td valign="top">
929
- <?php
930
- if ( isset( $cpt_tax_type["cpt_name"] ) ) {
931
- echo stripslashes($cpt_tax_type["cpt_name"]);
932
- } elseif ( is_array( $cpt_tax_type[1] ) ) {
933
- foreach ($cpt_tax_type[1] as $cpt_post_types) {
934
- echo $cpt_post_types .'<br />';
935
- }
936
- }
937
- ?>
938
- </td>
939
- <td valign="top"><?php echo disp_boolean($cpt_tax_type["hierarchical"]); ?></td>
940
- <td valign="top"><?php echo disp_boolean($cpt_tax_type["show_ui"]); ?></td>
941
- <td valign="top"><?php echo disp_boolean($cpt_tax_type["rewrite"]); ?></td>
942
- <td valign="top"><?php echo $rewrite_slug; ?></td>
943
- </tr>
944
- <tr>
945
- <td colspan="10">
946
- <div style="display:none;" id="slidepanel<?php echo $thecounter; ?>">
947
- <?php
948
- $cpt_tax_sanitized_name = str_replace( '-', '_', $cpt_tax_type['name'] );
949
- //display register_taxonomy code
950
- $custom_tax = '';
951
- $custom_tax = "add_action('init', 'cptui_register_my_taxes_" . $cpt_tax_sanitized_name . "');\n";
952
- $custom_tax .= "function cptui_register_my_taxes_" . $cpt_tax_sanitized_name . "() {\n";
953
-
954
- if ( !$cpt_tax_type["label"] ) {
955
- $cpt_label = esc_html( $cpt_tax_type["name"] );
956
- } else {
957
- $cpt_label = esc_html( $cpt_tax_type["label"] );
958
- }
959
-
960
- //check if singular label was filled out
961
- if ( !$cpt_tax_type["singular_label"] ) {
962
- $cpt_singular_label = esc_html( $cpt_tax_type["name"] );
963
- } else {
964
- $cpt_singular_label = esc_html( $cpt_tax_type["singular_label"] );
965
- }
966
-
967
- $labels = var_export( array(
968
- 'search_items' => ( !empty( $cpt_tax_type["singular_label"] ) ) ? esc_html( $cpt_tax_type["singular_label"] ) : '',
969
- 'popular_items' => ( !empty( $cpt_tax_type[0]["popular_items"] ) ) ? esc_html( $cpt_tax_type[0]["popular_items"] ) : '',
970
- 'all_items' => ( !empty( $cpt_tax_type[0]["all_items"] ) ) ? esc_html( $cpt_tax_type[0]["all_items"] ) : '',
971
- 'parent_item' => ( !empty( $cpt_tax_type[0]["parent_item"] ) ) ? esc_html( $cpt_tax_type[0]["parent_item"] ) : '',
972
- 'parent_item_colon' => ( !empty( $cpt_tax_type[0]["parent_item_colon"] ) ) ? esc_html( $cpt_tax_type[0]["parent_item_colon"] ) : '',
973
- 'edit_item' => ( !empty( $cpt_tax_type[0]["edit_item"] ) ) ? esc_html( $cpt_tax_type[0]["edit_item"] ) : '',
974
- 'update_item' => ( !empty( $cpt_tax_type[0]["update_item"] ) ) ? esc_html( $cpt_tax_type[0]["update_item"] ) : '',
975
- 'add_new_item' => ( !empty( $cpt_tax_type[0]["add_new_item"] ) ) ? esc_html( $cpt_tax_type[0]["add_new_item"] ) : '',
976
- 'new_item_name' => ( !empty( $cpt_tax_type[0]["new_item_name"] ) ) ? esc_html( $cpt_tax_type[0]["new_item_name"] ) : '',
977
- 'separate_items_with_commas' => ( !empty( $cpt_tax_type[0]["separate_items_with_commas"] ) ) ? esc_html( $cpt_tax_type[0]["separate_items_with_commas"] ) : '',
978
- 'add_or_remove_items' => ( !empty( $cpt_tax_type[0]["add_or_remove_items"] ) ) ? esc_html( $cpt_tax_type[0]["add_or_remove_items"] ) : '',
979
- 'choose_from_most_used' => ( !empty( $cpt_tax_type[0]["choose_from_most_used"] ) ) ? esc_html( $cpt_tax_type[0]["choose_from_most_used"] ) : ''
980
- ), true );
981
-
982
- $cpt_post_types = ( !$cpt_tax_type[1] ) ? $cpt_tax_type["cpt_name"] : var_export( $cpt_tax_type[1], true );
983
-
984
- //register our custom taxonomies
985
- $custom_tax .= "register_taxonomy( '" . $cpt_tax_type["name"] . "',";
986
- $custom_tax .= $cpt_post_types . ",\n";
987
- $custom_tax .= "array( 'hierarchical' => " . disp_boolean( $cpt_tax_type["hierarchical"] ) . ",\n";
988
- $custom_tax .= "\t'label' => '" . $cpt_label . "',\n";
989
- $custom_tax .= "\t'show_ui' => " . disp_boolean( $cpt_tax_type["show_ui"] ) . ",\n";
990
- $custom_tax .= "\t'query_var' => " . disp_boolean( $cpt_tax_type["query_var"] ) . ",\n";
991
- if ( !empty( $cpt_tax_type["rewrite_slug"] ) ) {
992
- $custom_tax .= "\t'rewrite' => array( 'slug' => '" . $cpt_tax_type["rewrite_slug"] . "' ),\n";
993
- }
994
-
995
-
996
- if ( version_compare( CPTUI_WP_VERSION, '3.5', '>' ) ) {
997
- $custom_tax .= "\t'show_admin_column' => " . disp_boolean( $cpt_tax_type["show_admin_column"] ) . ",\n";
998
- }
999
-
1000
-
1001
- if ( !empty( $labels ) )
1002
- $custom_tax .= "\t'labels' => " . $labels . "\n";
1003
- $custom_tax .= ") ); \n}";
1004
-
1005
- echo '<br>';
1006
- echo _e('Place the below code in your themes functions.php file to manually create this custom taxonomy','cpt-plugin').'<br>';
1007
- echo _e('This is a <strong>BETA</strong> feature. Please <a href="http://webdevstudios.com/support/forum/custom-post-type-ui/">report bugs</a>.','cpt-plugin').'<br>';
1008
- echo '<textarea rows="10" cols="100">' .$custom_tax .'</textarea>';
1009
- ?>
1010
- </div>
1011
- </td>
1012
- </tr>
1013
- <?php
1014
- $thecounter++;
1015
  }
1016
- ?></table>
1017
- </div>
1018
- <?php
1019
- //load footer
1020
- cpt_footer();
1021
- }
1022
- }
1023
-
1024
- //add new custom post type / taxonomy page
1025
- function cpt_add_new() {
1026
- global $cpt_error, $CPT_URL;
1027
-
1028
- $RETURN_URL = ( isset( $_GET['return'] ) ) ? 'action="' . cpt_check_return( esc_attr( $_GET['return'] ) ) . '"' : '';
1029
-
1030
- //check if we are editing a custom post type or creating a new one
1031
- if ( isset( $_GET['edittype'] ) && !isset( $_GET['cpt_edit'] ) ) {
1032
- check_admin_referer('cpt_edit_post_type');
1033
-
1034
- //get post type to edit. This will reference array index for our option.
1035
- $editType = intval($_GET['edittype']);
1036
-
1037
- //load custom posts saved in WP
1038
- $cpt_options = get_option('cpt_custom_post_types');
1039
-
1040
- //load custom post type values to edit
1041
- $cpt_post_type_name = ( isset( $cpt_options[ $editType ]["name"] ) ) ? $cpt_options[ $editType ]["name"] : null;
1042
- $cpt_label = ( isset( $cpt_options[ $editType ]["label"] ) ) ? $cpt_options[ $editType ]["label"] : null;
1043
- $cpt_singular_label = ( isset( $cpt_options[ $editType ]["singular_label"] ) ) ? $cpt_options[ $editType ]["singular_label"] : null;
1044
- $cpt_public = ( isset( $cpt_options[ $editType ]["public"] ) ) ? $cpt_options[ $editType ]["public"] : null;
1045
- $cpt_showui = ( isset( $cpt_options[ $editType ]["show_ui"] ) ) ? $cpt_options[ $editType ]["show_ui"] : null;
1046
- $cpt_capability = ( isset( $cpt_options[ $editType ]["capability_type"] ) ) ? $cpt_options[ $editType ]["capability_type"] : null;
1047
- $cpt_hierarchical = ( isset( $cpt_options[ $editType ]["hierarchical"] ) ) ? $cpt_options[ $editType ]["hierarchical"] : null;
1048
- $cpt_rewrite = ( isset( $cpt_options[ $editType ]["rewrite"] ) ) ? $cpt_options[ $editType ]["rewrite"] : null;
1049
- $cpt_rewrite_slug = ( isset( $cpt_options[ $editType ]["rewrite_slug"] ) ) ? $cpt_options[ $editType ]["rewrite_slug"] : null;
1050
- $cpt_rewrite_withfront = ( isset( $cpt_options[ $editType ]["rewrite_withfront"] ) ) ? $cpt_options[ $editType ]["rewrite_withfront"] : null;
1051
- $cpt_query_var = ( isset( $cpt_options[ $editType ]["query_var"] ) ) ? $cpt_options[ $editType ]["query_var"] : null;
1052
- $cpt_description = ( isset( $cpt_options[ $editType ]["description"] ) ) ? $cpt_options[ $editType ]["description"] : null;
1053
- $cpt_menu_position = ( isset( $cpt_options[ $editType ]["menu_position"] ) ) ? $cpt_options[ $editType ]["menu_position"] : null;
1054
- $cpt_menu_icon = ( isset( $cpt_options[ $editType ]["menu_icon"] ) ) ? $cpt_options[ $editType ]["menu_icon"] : null;
1055
- $cpt_supports = ( isset( $cpt_options[ $editType ][0] ) ) ? $cpt_options[ $editType ][0] : null;
1056
- $cpt_taxes = ( isset( $cpt_options[ $editType ][1] ) )? $cpt_options[ $editType ][1] : null;
1057
- $cpt_labels = ( isset( $cpt_options[ $editType ][2] ) ) ? $cpt_options[ $editType ][2] : null;
1058
- $cpt_has_archive = ( isset( $cpt_options[$editType]["has_archive"] ) ) ? $cpt_options[$editType]["has_archive"] : null;
1059
- $cpt_exclude_from_search = ( isset( $cpt_options[$editType]["exclude_from_search"] ) ) ? $cpt_options[$editType]["exclude_from_search"] : null;
1060
- $cpt_show_in_menu = ( isset( $cpt_options[$editType]["show_in_menu"] ) ) ? $cpt_options[$editType]["show_in_menu"] : true;
1061
- $cpt_show_in_menu_string = ( isset( $cpt_options[$editType]["show_in_menu_string"] ) ) ? $cpt_options[$editType]["show_in_menu_string"] : null;
1062
-
1063
- $cpt_submit_name = __( 'Save Custom Post Type', 'cpt-plugin' );
1064
- } else {
1065
- $cpt_submit_name = __( 'Create Custom Post Type', 'cpt-plugin' );
1066
- }
1067
-
1068
- if ( isset( $_GET['edittax'] ) && !isset( $_GET['cpt_edit'] ) ) {
1069
- check_admin_referer('cpt_edit_tax');
1070
-
1071
- //get post type to edit
1072
- $editTax = intval($_GET['edittax']);
1073
-
1074
- //load custom posts saved in WP
1075
- $cpt_options = get_option('cpt_custom_tax_types');
1076
-
1077
- //load custom taxonomy values to edit
1078
- $cpt_tax_name = $cpt_options[$editTax]["name"];
1079
- $cpt_tax_label = stripslashes( $cpt_options[$editTax]["label"] );
1080
- $cpt_singular_label_tax = stripslashes( $cpt_options[$editTax]["singular_label"] );
1081
- $cpt_tax_object_type = ( isset( $cpt_options[$editTax]["cpt_name"] ) ) ? $cpt_options[$editTax]["cpt_name"] : null;
1082
- $cpt_tax_hierarchical = $cpt_options[$editTax]["hierarchical"];
1083
- $cpt_tax_showui = $cpt_options[$editTax]["show_ui"];
1084
- $cpt_tax_query_var = $cpt_options[$editTax]["query_var"];
1085
- $cpt_tax_rewrite = $cpt_options[$editTax]["rewrite"];
1086
- $cpt_tax_rewrite_slug = $cpt_options[$editTax]["rewrite_slug"];
1087
- $cpt_tax_show_admin_column = $cpt_options[$editTax]["show_admin_column"];
1088
- $cpt_tax_labels = stripslashes_deep( $cpt_options[$editTax][0] );
1089
- $cpt_post_types = $cpt_options[$editTax][1];
1090
-
1091
- $cpt_tax_submit_name = __( 'Save Custom Taxonomy', 'cpt-plugin' );
1092
- } else {
1093
- $cpt_tax_submit_name = __( 'Create Custom Taxonomy', 'cpt-plugin' );
1094
  }
1095
 
1096
- //flush rewrite rules
1097
- flush_rewrite_rules();
1098
-
1099
- /*
1100
- BEGIN 'ADD NEW' PAGE OUTPUT
1101
  */
 
1102
  ?>
1103
- <div class="wrap">
1104
- <?php
1105
- //check for success/error messages
1106
- if ( isset( $_GET['cpt_msg'] ) ) : ?>
1107
-
1108
- <div id="message" class="updated">
1109
- <?php if ( $_GET['cpt_msg'] == 1 ) {
1110
- _e( 'Custom post type created successfully. You may need to refresh to view the new post type in the admin menu.', 'cpt-plugin' );
1111
- echo '<a href="' . cpt_check_return( 'cpt' ) . '"> ' . __( 'Manage custom post types', 'cpt-plugin') . '</a>';
1112
- } elseif ( $_GET['cpt_msg'] == 2 ) {
1113
- _e('Custom taxonomy created successfully. You may need to refresh to view the new taxonomy in the admin menu.', 'cpt-plugin' );
1114
- echo '<a href="' . cpt_check_return( 'tax' ) . '"> ' . __( 'Manage custom taxonomies', 'cpt-plugin') . '</a>';
1115
- } ?>
1116
- </div>
1117
- <?php
1118
- else :
1119
- if ( isset( $_GET['cpt_error'] ) ) : ?>
1120
- <div class="error">
1121
- <?php if ( $_GET['cpt_error'] == 1 ) {
1122
- _e( 'Post type name is a required field.', 'cpt-plugin' );
1123
- }
1124
- if ( $_GET['cpt_error'] == 2 ) {
1125
- _e( 'Taxonomy name is a required field.', 'cpt-plugin' );
1126
- }
1127
- if ( $_GET['cpt_error'] == 3 ) {
1128
- _e( 'You must assign your custom taxonomy to at least one post type.', 'cpt-plugin' );
1129
- }
1130
- if ( $_GET['cpt_error'] == 4 ) {
1131
- _e( 'Please doe not use quotes in your post type slug or rewrite slug.', 'cpt-plugin' );
1132
- }
1133
- if ( $_GET['cpt_error'] == 5 ) {
1134
- _e( 'Please doe not use quotes in your taxonomy slug or rewrite slug.', 'cpt-plugin' );
1135
- } ?>
1136
- </div>
1137
- <?php
1138
- endif;
1139
- endif;
1140
-
1141
- screen_icon( 'plugins' );
1142
-
1143
- if ( isset( $_GET['edittype'] ) || isset( $_GET['edittax'] ) ) { ?>
1144
- <h2>
1145
- <?php _e('Edit Custom Post Type or Taxonomy', 'cpt-plugin') ?> &middot;
1146
- <a href="<?php echo cpt_check_return( 'add' ); ?>">
1147
- <?php _e('Reset', 'cpt-plugin');?>
1148
- </a>
1149
- </h2>
1150
- <?php } else { ?>
1151
- <h2>
1152
- <?php _e('Create New Custom Post Type or Taxonomy', 'cpt-plugin') ?> &middot;
1153
- <a href="<?php echo cpt_check_return( 'add' ); ?>">
1154
- <?php _e('Reset', 'cpt-plugin');?>
1155
- </a>
1156
- </h2>
1157
- <?php } ?>
1158
- <table border="0" cellspacing="10" class="widefat">
1159
- <?php
1160
- //BEGIN CPT HALF
1161
- ?>
1162
- <tr>
1163
- <td width="50%" valign="top">
1164
- <p><?php _e('If you are unfamiliar with the options below only fill out the <strong>Post Type Name</strong> and <strong>Label</strong> fields and check which meta boxes to support. The other settings are set to the most common defaults for custom post types. Hover over the question mark for more details.', 'cpt-plugin'); ?></p>
1165
- <form method="post" <?php echo $RETURN_URL; ?>>
1166
- <?php
1167
- if ( function_exists( 'wp_nonce_field' ) )
1168
- wp_nonce_field( 'cpt_add_custom_post_type' );
1169
- ?>
1170
- <?php if ( isset( $_GET['edittype'] ) ) { ?>
1171
- <input type="hidden" name="cpt_edit" value="<?php echo esc_attr( $editType ); ?>" />
1172
- <?php } ?>
1173
- <table class="form-table">
1174
- <tr valign="top">
1175
- <th scope="row"><?php _e('Post Type Name', 'cpt-plugin') ?> <span class="required">*</span> <a href="#" title="<?php esc_attr_e( 'The post type name. Used to retrieve custom post type content. Should be short and sweet', 'cpt-plugin'); ?>" class="help">?</a></th>
1176
- <td><input type="text" name="cpt_custom_post_type[name]" tabindex="1" value="<?php if (isset($cpt_post_type_name)) { echo esc_attr($cpt_post_type_name); } ?>" maxlength="20" onblur="this.value=this.value.toLowerCase()" /> <?php _e( '(e.g. movie)', 'cpt-plugin' ); ?>
1177
- <br />
1178
- <p><strong><?php _e( 'Max 20 characters, can not contain capital letters or spaces. Reserved post types: post, page, attachment, revision, nav_menu_item.', 'cpt-plugin' ); ?></strong></p>
1179
- </td>
1180
- </tr>
1181
-
1182
- <tr valign="top">
1183
- <th scope="row"><?php _e('Label', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Post type label. Used in the admin menu for displaying post types.', 'cpt-plugin' ); ?>" class="help">?</a></th>
1184
- <td><input type="text" name="cpt_custom_post_type[label]" tabindex="2" value="<?php if (isset($cpt_label)) { echo esc_attr($cpt_label); } ?>" /> <?php _e( '(e.g. Movies)', 'cpt-plugin' ); ?></td>
1185
- </tr>
1186
-
1187
- <tr valign="top">
1188
- <th scope="row"><?php _e('Singular Label', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Custom Post Type Singular label. Used in WordPress when a singular label is needed.', 'cpt-plugin' ); ?>" class="help">?</a></th>
1189
- <td><input type="text" name="cpt_custom_post_type[singular_label]" tabindex="3" value="<?php if (isset($cpt_singular_label)) { echo esc_attr($cpt_singular_label); } ?>" /> <?php _e( '(e.g. Movie)', 'cpt-plugin' ); ?></td>
1190
-
1191
- </tr>
1192
-
1193
- <tr valign="top">
1194
- <th scope="row"><?php _e('Description', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Custom Post Type Description. Describe what your custom post type is used for.', 'cpt-plugin' ); ?>" class="help">?</a></th>
1195
- <td><textarea name="cpt_custom_post_type[description]" tabindex="4" rows="4" cols="40"><?php if (isset($cpt_description)) { echo esc_attr($cpt_description); } ?></textarea></td>
1196
- </tr>
1197
-
1198
- <tr valign="top">
1199
- <td colspan="2">
1200
- <p align="center">
1201
- <?php echo '<a href="#" class="comment_button" id="1">' . __( 'Advanced Label Options', 'cpt-plugin' ) . '</a>'; ?> |
1202
- <?php echo '<a href="#" class="comment_button" id="2">' . __( 'Advanced Options', 'cpt-plugin' ) . '</a>'; ?>
1203
- </p>
1204
- </td>
1205
- </tr>
1206
-
1207
- </table>
1208
-
1209
- <div style="display:none;" id="slidepanel1">
1210
- <p><?php _e('Below are the advanced label options for custom post types. If you are unfamiliar with these labels, leave them blank and the plugin will automatically create labels based off of your custom post type name', 'cpt-plugin'); ?></p>
1211
- <table class="form-table">
1212
-
1213
- <tr valign="top">
1214
- <th scope="row"><?php _e('Menu Name', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Custom menu name for your custom post type.', 'cpt-plugin' ); ?>" class="help">?</a></th>
1215
- <td><input type="text" name="cpt_labels[menu_name]" tabindex="2" value="<?php if (isset($cpt_labels["menu_name"])) { echo esc_attr($cpt_labels["menu_name"]); } ?>" /><br/>
1216
- <?php _e( '(e.g. My Movies)', 'cpt-plugin' ); ?></td>
1217
- </tr>
1218
-
1219
- <tr valign="top">
1220
- <th scope="row"><?php _e('Add New', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Post type label. Used in the admin menu for displaying post types.', 'cpt-plugin' ); ?>" class="help">?</a></th>
1221
- <td><input type="text" name="cpt_labels[add_new]" tabindex="2" value="<?php if (isset($cpt_labels["add_new"])) { echo esc_attr($cpt_labels["add_new"]); } ?>" /><br/>
1222
- <?php _e( '(e.g. Add New)', 'cpt-plugin' ); ?></td>
1223
- </tr>
1224
-
1225
- <tr valign="top">
1226
- <th scope="row"><?php _e('Add New Item', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Post type label. Used in the admin menu for displaying post types.', 'cpt-plugin' ); ?>" class="help">?</a></th>
1227
- <td><input type="text" name="cpt_labels[add_new_item]" tabindex="2" value="<?php if (isset($cpt_labels["add_new_item"])) { echo esc_attr($cpt_labels["add_new_item"]); } ?>" /><br/>
1228
- <?php _e( '(e.g. Add New Movie)', 'cpt-plugin' ); ?></td>
1229
- </tr>
1230
-
1231
- <tr valign="top">
1232
- <th scope="row"><?php _e('Edit', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Post type label. Used in the admin menu for displaying post types.', 'cpt-plugin' ); ?>" class="help">?</a></th>
1233
- <td><input type="text" name="cpt_labels[edit]" tabindex="2" value="<?php if (isset($cpt_labels["edit"])) { echo esc_attr($cpt_labels["edit"]); } ?>" /><br/>
1234
- <?php _e( '(e.g. Edit)', 'cpt-plugin' ); ?></td>
1235
- </tr>
1236
-
1237
- <tr valign="top">
1238
- <th scope="row"><?php _e('Edit Item', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Post type label. Used in the admin menu for displaying post types.', 'cpt-plugin' ); ?>" class="help">?</a></th>
1239
- <td><input type="text" name="cpt_labels[edit_item]" tabindex="2" value="<?php if (isset($cpt_labels["edit_item"])) { echo esc_attr($cpt_labels["edit_item"]); } ?>" /><br/>
1240
- <?php _e( '(e.g. Edit Movie)', 'cpt-plugin' ); ?></td>
1241
- </tr>
1242
-
1243
- <tr valign="top">
1244
- <th scope="row"><?php _e('New Item', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Post type label. Used in the admin menu for displaying post types.', 'cpt-plugin' ); ?>" class="help">?</a></th>
1245
- <td><input type="text" name="cpt_labels[new_item]" tabindex="2" value="<?php if (isset($cpt_labels["new_item"])) { echo esc_attr($cpt_labels["new_item"]); } ?>" /><br/>
1246
- <?php _e( '(e.g. New Movie)', 'cpt-plugin' ); ?></td>
1247
- </tr>
1248
-
1249
- <tr valign="top">
1250
- <th scope="row"><?php _e('View', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Post type label. Used in the admin menu for displaying post types.', 'cpt-plugin' ); ?>" class="help">?</a></th>
1251
- <td><input type="text" name="cpt_labels[view]" tabindex="2" value="<?php if (isset($cpt_labels["view"])) { echo esc_attr($cpt_labels["view"]); } ?>" /><br/>
1252
- <?php _e( '(e.g. View Movie)', 'cpt-plugin' ); ?></td>
1253
- </tr>
1254
-
1255
- <tr valign="top">
1256
- <th scope="row"><?php _e('View Item', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Post type label. Used in the admin menu for displaying post types.', 'cpt-plugin' ); ?>" class="help">?</a></th>
1257
- <td><input type="text" name="cpt_labels[view_item]" tabindex="2" value="<?php if (isset($cpt_labels["view_item"])) { echo esc_attr($cpt_labels["view_item"]); } ?>" /><br/>
1258
- <?php _e( '(e.g. View Movie)', 'cpt-plugin' ); ?></td>
1259
- </tr>
1260
-
1261
- <tr valign="top">
1262
- <th scope="row"><?php _e('Search Items', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Post type label. Used in the admin menu for displaying post types.', 'cpt-plugin' ); ?>" class="help">?</a></th>
1263
- <td><input type="text" name="cpt_labels[search_items]" tabindex="2" value="<?php if (isset($cpt_labels["search_items"])) { echo esc_attr($cpt_labels["search_items"]); } ?>" /><br/>
1264
- <?php _e( '(e.g. Search Movies)', 'cpt-plugin' ); ?></td>
1265
- </tr>
1266
-
1267
- <tr valign="top">
1268
- <th scope="row"><?php _e('Not Found', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Post type label. Used in the admin menu for displaying post types.', 'cpt-plugin' ); ?>" class="help">?</a></th>
1269
- <td><input type="text" name="cpt_labels[not_found]" tabindex="2" value="<?php if (isset($cpt_labels["not_found"])) { echo esc_attr($cpt_labels["not_found"]); } ?>" /><br/>
1270
- <?php _e( '(e.g. No Movies Found)', 'cpt-plugin' ); ?></td>
1271
- </tr>
1272
-
1273
- <tr valign="top">
1274
- <th scope="row"><?php _e('Not Found in Trash', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Post type label. Used in the admin menu for displaying post types.', 'cpt-plugin' ); ?>" class="help">?</a></th>
1275
- <td><input type="text" name="cpt_labels[not_found_in_trash]" tabindex="2" value="<?php if (isset($cpt_labels["not_found_in_trash"])) { echo esc_attr($cpt_labels["not_found_in_trash"]); } ?>" /><br/>
1276
- <?php _e( '(e.g. No Movies found in Trash)', 'cpt-plugin' ); ?></td>
1277
- </tr>
1278
-
1279
- <tr valign="top">
1280
- <th scope="row"><?php _e('Parent', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Post type label. Used in the admin menu for displaying post types.', 'cpt-plugin' ); ?>" class="help">?</a></th>
1281
- <td><input type="text" name="cpt_labels[parent]" tabindex="2" value="<?php if (isset($cpt_labels["parent"])) { echo esc_attr($cpt_labels["parent"]); } ?>" /><br/>
1282
- <?php _e( '(e.g. Parent Movie)', 'cpt-plugin' ); ?></td>
1283
- </tr>
1284
-
1285
- </table>
1286
- </div>
1287
-
1288
- <div style="display:none;" id="slidepanel2">
1289
- <table class="form-table">
1290
- <tr valign="top">
1291
- <th scope="row"><?php _e('Public', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Whether posts of this type should be shown in the admin UI', 'cpt-plugin' ); ?>" class="help">?</a></th>
1292
- <td>
1293
- <select name="cpt_custom_post_type[public]" tabindex="4">
1294
- <option value="0" <?php if (isset($cpt_public)) { if ($cpt_public == 0 && $cpt_public != '') { echo 'selected="selected"'; } } ?>><?php _e( 'False', 'cpt-plugin' ); ?></option>
1295
- <option value="1" <?php if (isset($cpt_public)) { if ($cpt_public == 1 || is_null($cpt_public)) { echo 'selected="selected"'; } } else { echo 'selected="selected"'; } ?>><?php _e( 'True', 'cpt-plugin' ); ?></option>
1296
- </select> <?php _e( '(default: True)', 'cpt-plugin' ); ?>
1297
- </td>
1298
- </tr>
1299
-
1300
- <tr valign="top">
1301
- <th scope="row"><?php _e('Show UI', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Whether to generate a default UI for managing this post type', 'cpt-plugin' ); ?>" class="help">?</a></th>
1302
- <td>
1303
- <select name="cpt_custom_post_type[show_ui]" tabindex="5">
1304
- <option value="0" <?php if (isset($cpt_showui)) { if ($cpt_showui == 0 && $cpt_showui != '') { echo 'selected="selected"'; } } ?>><?php _e( 'False', 'cpt-plugin' ); ?></option>
1305
- <option value="1" <?php if (isset($cpt_showui)) { if ($cpt_showui == 1 || is_null($cpt_showui)) { echo 'selected="selected"'; } } else { echo 'selected="selected"'; } ?>><?php _e( 'True', 'cpt-plugin' ); ?></option>
1306
- </select> <?php _e( '(default: True)', 'cpt-plugin' ); ?>
1307
- </td>
1308
- </tr>
1309
-
1310
- <tr valign="top">
1311
- <th scope="row"><?php _e('Has Archive', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Whether the post type will have a post type archive page', 'cpt-plugin' ); ?>" class="help">?</a></th>
1312
- <td>
1313
- <select name="cpt_custom_post_type[has_archive]" tabindex="6">
1314
- <option value="0" <?php if (isset($cpt_has_archive)) { if ($cpt_has_archive == 0) { echo 'selected="selected"'; } } else { echo 'selected="selected"'; } ?>><?php _e( 'False', 'cpt-plugin' ); ?></option>
1315
- <option value="1" <?php if (isset($cpt_has_archive)) { if ($cpt_has_archive == 1) { echo 'selected="selected"'; } } ?>><?php _e( 'True', 'cpt-plugin' ); ?></option>
1316
- </select> <?php _e( '(default: False)', 'cpt-plugin' ); ?>
1317
- </td>
1318
- </tr>
1319
-
1320
- <tr valign="top">
1321
- <th scope="row"><?php _e('Exclude From Search', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Whether the post type will be searchable', 'cpt-plugin' ); ?>" class="help">?</a></th>
1322
- <td>
1323
- <select name="cpt_custom_post_type[exclude_from_search]" tabindex="6">
1324
- <option value="0" <?php if (isset($cpt_exclude_from_search)) { if ($cpt_exclude_from_search == 0) { echo 'selected="selected"'; } } else { echo 'selected="selected"'; } ?>><?php _e( 'False', 'cpt-plugin' ); ?></option>
1325
- <option value="1" <?php if (isset($cpt_exclude_from_search)) { if ($cpt_exclude_from_search == 1) { echo 'selected="selected"'; } } ?>><?php _e( 'True', 'cpt-plugin' ); ?></option>
1326
- </select> <?php _e( '(default: False)', 'cpt-plugin' ); ?>
1327
- </td>
1328
- </tr>
1329
-
1330
- <tr valign="top">
1331
- <th scope="row"><?php _e('Capability Type', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'The post type to use for checking read, edit, and delete capabilities', 'cpt-plugin' ); ?>" class="help">?</a></th>
1332
- <td><input type="text" name="cpt_custom_post_type[capability_type]" tabindex="6" value="<?php if ( isset( $cpt_capability ) ) { echo esc_attr( $cpt_capability ); } else { echo 'post'; } ?>" /></td>
1333
- </tr>
1334
-
1335
- <tr valign="top">
1336
- <th scope="row"><?php _e('Hierarchical', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Whether the post type can have parent-child relationships', 'cpt-plugin' ); ?>" class="help">?</a></th>
1337
- <td>
1338
- <select name="cpt_custom_post_type[hierarchical]" tabindex="8">
1339
- <option value="0" <?php if (isset($cpt_hierarchical)) { if ($cpt_hierarchical == 0) { echo 'selected="selected"'; } } else { echo 'selected="selected"'; } ?>><?php _e( 'False', 'cpt-plugin' ); ?></option>
1340
- <option value="1" <?php if (isset($cpt_hierarchical)) { if ($cpt_hierarchical == 1) { echo 'selected="selected"'; } } ?>><?php _e( 'True', 'cpt-plugin' ); ?></option>
1341
- </select> <?php _e( '(default: False)', 'cpt-plugin' ); ?>
1342
- </td>
1343
- </tr>
1344
-
1345
- <tr valign="top">
1346
- <th scope="row"><?php _e('Rewrite', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Triggers the handling of rewrites for this post type', 'cpt-plugin' ); ?>" class="help">?</a></th>
1347
- <td>
1348
- <select name="cpt_custom_post_type[rewrite]" tabindex="9">
1349
- <option value="0" <?php if (isset($cpt_rewrite)) { if ($cpt_rewrite == 0 && $cpt_rewrite != '') { echo 'selected="selected"'; } } ?>><?php _e( 'False', 'cpt-plugin' ); ?></option>
1350
- <option value="1" <?php if (isset($cpt_rewrite)) { if ($cpt_rewrite == 1 || is_null($cpt_rewrite)) { echo 'selected="selected"'; } } else { echo 'selected="selected"'; } ?>><?php _e( 'True', 'cpt-plugin' ); ?></option>
1351
- </select> <?php _e( '(default: True)', 'cpt-plugin' ); ?>
1352
- </td>
1353
- </tr>
1354
-
1355
- <tr valign="top">
1356
- <th scope="row"><?php _e('Custom Rewrite Slug', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Custom slug to use instead of the default.' ,'cpt-plugin' ); ?>" class="help">?</a></th>
1357
- <td><input type="text" name="cpt_custom_post_type[rewrite_slug]" tabindex="10" value="<?php if (isset($cpt_rewrite_slug)) { echo esc_attr($cpt_rewrite_slug); } ?>" /> <?php _e( '(default: post type name)', 'cpt-plugin' ); ?></td>
1358
- </tr>
1359
-
1360
- <tr valign="top">
1361
- <th scope="row"><?php _e('With Front', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Should the permastruct be prepended with the front base.', 'cpt-plugin' ); ?>" class="help">?</a></th>
1362
- <td>
1363
- <select name="cpt_custom_post_type[rewrite_withfront]" tabindex="4">
1364
- <option value="0" <?php if (isset($cpt_rewrite_withfront)) { if ($cpt_rewrite_withfront == 0 && $cpt_rewrite_withfront != '') { echo 'selected="selected"'; } } ?>><?php _e( 'False', 'cpt-plugin' ); ?></option>
1365
- <option value="1" <?php if (isset($cpt_rewrite_withfront)) { if ($cpt_rewrite_withfront == 1 || is_null($cpt_rewrite_withfront)) { echo 'selected="selected"'; } } else { echo 'selected="selected"'; } ?>><?php _e( 'True', 'cpt-plugin' ); ?></option>
1366
- </select> <?php _e( '(default: True)', 'cpt-plugin' ); ?>
1367
- </td>
1368
- </tr>
1369
-
1370
- <tr valign="top">
1371
- <th scope="row"><?php _e('Query Var', 'cpt-plugin') ?> <a href="#" title="" class="help">?</a></th>
1372
- <td>
1373
- <select name="cpt_custom_post_type[query_var]" tabindex="10">
1374
- <option value="0" <?php if (isset($cpt_query_var)) { if ($cpt_query_var == 0 && $cpt_query_var != '') { echo 'selected="selected"'; } } ?>><?php _e( 'False', 'cpt-plugin' ); ?></option>
1375
- <option value="1" <?php if (isset($cpt_query_var)) { if ($cpt_query_var == 1 || is_null($cpt_query_var)) { echo 'selected="selected"'; } } else { echo 'selected="selected"'; } ?>><?php _e( 'True', 'cpt-plugin' ); ?></option>
1376
- </select> <?php _e( '(default: True)', 'cpt-plugin' ); ?>
1377
- </td>
1378
- </tr>
1379
-
1380
- <tr valign="top">
1381
- <th scope="row"><?php _e('Menu Position', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'The position in the menu order the post type should appear. show_in_menu must be true.', 'cpt-plugin' ); ?>" class="help">?</a>
1382
- <p><?php _e( 'See <a href="http://codex.wordpress.org/Function_Reference/register_post_type#Parameters">Available options</a> in the "menu_position" section. Range of 5-100', 'cpt-plugin' ); ?></p>
1383
- </th>
1384
- <td><input type="text" name="cpt_custom_post_type[menu_position]" tabindex="11" size="5" value="<?php if (isset($cpt_menu_position)) { echo esc_attr($cpt_menu_position); } ?>" /></td>
1385
- </tr>
1386
-
1387
- <tr valign="top">
1388
- <th scope="row"><?php _e('Show in Menu', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Whether to show the post type in the admin menu and where to show that menu. Note that show_ui must be true', 'cpt-plugin' ); ?>" class="help">?</a>
1389
- <p><?php _e( '"Show UI" must be "true". If an existing top level page such as "tools.php" is indicated for second input, post type will be sub menu of that.', 'cpt-plugins' ); ?></p>
1390
- </th>
1391
- <td>
1392
- <p><select name="cpt_custom_post_type[show_in_menu]" tabindex="10">
1393
- <option value="0" <?php if (isset($cpt_show_in_menu)) { if ($cpt_show_in_menu == 0) { echo 'selected="selected"'; } } ?>><?php _e( 'False', 'cpt-plugin' ); ?></option>
1394
- <option value="1" <?php if (isset($cpt_show_in_menu)) { if ($cpt_show_in_menu == 1 || is_null($cpt_show_in_menu)) { echo 'selected="selected"'; } } else { echo 'selected="selected"'; } ?>><?php _e( 'True', 'cpt-plugin' ); ?></option>
1395
- </select></p>
1396
- <p>
1397
- <input type="text" name="cpt_custom_post_type[show_in_menu_string]" tabindex="12" size="20" value="<?php if (isset($cpt_show_in_menu_string)) { echo esc_attr($cpt_show_in_menu_string); } ?>" /></p></td>
1398
- </tr>
1399
-
1400
- <tr valign="top">
1401
- <th scope="row"><?php _e('Menu Icon', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'URL to image to be used as menu icon.', 'cpt-plugin' ); ?>" class="help">?</a>
1402
- </th>
1403
- <td><input type="text" name="cpt_custom_post_type[menu_icon]" tabindex="11" size="20" value="<?php if (isset($cpt_menu_icon)) { echo esc_attr($cpt_menu_icon); } ?>" /> (Full URL for icon)</td>
1404
- </tr>
1405
-
1406
- <tr valign="top">
1407
- <th scope="row"><?php _e('Supports', 'cpt-plugin') ?></th>
1408
- <td>
1409
- <input type="checkbox" name="cpt_supports[]" tabindex="11" value="title" <?php if (isset($cpt_supports) && is_array($cpt_supports)) { if (in_array('title', $cpt_supports)) { echo 'checked="checked"'; } } elseif (!isset($_GET['edittype'])) { echo 'checked="checked"'; } ?> />&nbsp;<?php _e( 'Title' , 'cpt-plugin' ); ?> <a href="#" title="<?php esc_attr_e( 'Adds the title meta box when creating content for this custom post type', 'cpt-plugin' ); ?>" class="help">?</a> <br/ >
1410
- <input type="checkbox" name="cpt_supports[]" tabindex="12" value="editor" <?php if (isset($cpt_supports) && is_array($cpt_supports)) { if (in_array('editor', $cpt_supports)) { echo 'checked="checked"'; } } elseif (!isset($_GET['edittype'])) { echo 'checked="checked"'; } ?> />&nbsp;<?php _e( 'Editor' , 'cpt-plugin' ); ?> <a href="#" title="<?php esc_attr_e( 'Adds the content editor meta box when creating content for this custom post type', 'cpt-plugin' ); ?>" class="help">?</a> <br/ >
1411
- <input type="checkbox" name="cpt_supports[]" tabindex="13" value="excerpt" <?php if (isset($cpt_supports) && is_array($cpt_supports)) { if (in_array('excerpt', $cpt_supports)) { echo 'checked="checked"'; } } elseif (!isset($_GET['edittype'])) { echo 'checked="checked"'; } ?> />&nbsp;<?php _e( 'Excerpt' , 'cpt-plugin' ); ?> <a href="#" title="<?php esc_attr_e( 'Adds the excerpt meta box when creating content for this custom post type', 'cpt-plugin' ); ?>" class="help">?</a> <br/ >
1412
- <input type="checkbox" name="cpt_supports[]" tabindex="14" value="trackbacks" <?php if (isset($cpt_supports) && is_array($cpt_supports)) { if (in_array('trackbacks', $cpt_supports)) { echo 'checked="checked"'; } } elseif (!isset($_GET['edittype'])) { echo 'checked="checked"'; } ?> />&nbsp;<?php _e( 'Trackbacks' , 'cpt-plugin' ); ?> <a href="#" title="<?php esc_attr_e( 'Adds the trackbacks meta box when creating content for this custom post type', 'cpt-plugin' ); ?>" class="help">?</a> <br/ >
1413
- <input type="checkbox" name="cpt_supports[]" tabindex="15" value="custom-fields" <?php if (isset($cpt_supports) && is_array($cpt_supports)) { if (in_array('custom-fields', $cpt_supports)) { echo 'checked="checked"'; } } elseif (!isset($_GET['edittype'])) { echo 'checked="checked"'; } ?> />&nbsp;<?php _e( 'Custom Fields' , 'cpt-plugin' ); ?> <a href="#" title="<?php esc_attr_e( 'Adds the custom fields meta box when creating content for this custom post type', 'cpt-plugin' ); ?>" class="help">?</a> <br/ >
1414
- <input type="checkbox" name="cpt_supports[]" tabindex="16" value="comments" <?php if (isset($cpt_supports) && is_array($cpt_supports)) { if (in_array('comments', $cpt_supports)) { echo 'checked="checked"'; } } elseif (!isset($_GET['edittype'])) { echo 'checked="checked"'; } ?> />&nbsp;<?php _e( 'Comments' , 'cpt-plugin' ); ?> <a href="#" title="<?php esc_attr_e( 'Adds the comments meta box when creating content for this custom post type', 'cpt-plugin' ); ?>" class="help">?</a> <br/ >
1415
- <input type="checkbox" name="cpt_supports[]" tabindex="17" value="revisions" <?php if (isset($cpt_supports) && is_array($cpt_supports)) { if (in_array('revisions', $cpt_supports)) { echo 'checked="checked"'; } } elseif (!isset($_GET['edittype'])) { echo 'checked="checked"'; } ?> />&nbsp;<?php _e( 'Revisions' , 'cpt-plugin' ); ?> <a href="#" title="<?php esc_attr_e( 'Adds the revisions meta box when creating content for this custom post type', 'cpt-plugin' ); ?>" class="help">?</a> <br/ >
1416
- <input type="checkbox" name="cpt_supports[]" tabindex="18" value="thumbnail" <?php if (isset($cpt_supports) && is_array($cpt_supports)) { if (in_array('thumbnail', $cpt_supports)) { echo 'checked="checked"'; } } elseif (!isset($_GET['edittype'])) { echo 'checked="checked"'; } ?> />&nbsp;<?php _e( 'Featured Image' , 'cpt-plugin' ); ?> <a href="#" title="<?php esc_attr_e( 'Adds the featured image meta box when creating content for this custom post type', 'cpt-plugin' ); ?>" class="help">?</a> <br/ >
1417
- <input type="checkbox" name="cpt_supports[]" tabindex="19" value="author" <?php if (isset($cpt_supports) && is_array($cpt_supports)) { if (in_array('author', $cpt_supports)) { echo 'checked="checked"'; } } elseif (!isset($_GET['edittype'])) { echo 'checked="checked"'; } ?> />&nbsp;<?php _e( 'Author' , 'cpt-plugin' ); ?> <a href="#" title="<?php esc_attr_e( 'Adds the author meta box when creating content for this custom post type', 'cpt-plugin' ); ?>" class="help">?</a> <br/ >
1418
- <input type="checkbox" name="cpt_supports[]" tabindex="20" value="page-attributes" <?php if (isset($cpt_supports) && is_array($cpt_supports)) { if (in_array('page-attributes', $cpt_supports)) { echo 'checked="checked"'; } } elseif (!isset($_GET['edittype'])) { echo 'checked="checked"'; } ?> />&nbsp;<?php _e( 'Page Attributes' , 'cpt-plugin' ); ?> <a href="#" title="<?php esc_attr_e( 'Adds the page attribute meta box when creating content for this custom post type', 'cpt-plugin' ); ?>" class="help">?</a> <br/ >
1419
- <input type="checkbox" name="cpt_supports[]" tabindex="21" value="post-formats" <?php if (isset($cpt_supports) && is_array($cpt_supports)) { if (in_array('post-formats', $cpt_supports)) { echo 'checked="checked"'; } } elseif (!isset($_GET['edittype'])) { echo 'checked="checked"'; } ?> />&nbsp;<?php _e( 'Post Formats' , 'cpt-plugin' ); ?> <a href="#" title="<?php esc_attr_e( 'Adds post format support', 'cpt-plugin' ); ?>" class="help">?</a> <br/ >
1420
- </td>
1421
- </tr>
1422
-
1423
- <tr valign="top">
1424
- <th scope="row"><?php _e('Built-in Taxonomies', 'cpt-plugin') ?></th>
1425
- <td>
1426
- <?php
1427
- //load built-in WP Taxonomies
1428
- $args=array( 'public' => true );
1429
- $output = 'objects';
1430
- $add_taxes = get_taxonomies($args,$output);
1431
- foreach ($add_taxes as $add_tax ) {
1432
- if ( $add_tax->name != 'nav_menu' && $add_tax->name != 'post_format') {
1433
- ?>
1434
- <input type="checkbox" name="cpt_addon_taxes[]" tabindex="20" value="<?php echo $add_tax->name; ?>" <?php if (isset($cpt_taxes) && is_array($cpt_taxes)) { if (in_array($add_tax->name, $cpt_taxes)) { echo 'checked="checked"'; } } ?> />&nbsp;<?php echo $add_tax->label; ?><br />
1435
- <?php
1436
- }
1437
- }
1438
- ?>
1439
- </td>
1440
- </tr>
1441
-
1442
- </table>
1443
- </div>
1444
-
1445
- <p class="submit">
1446
- <input type="submit" class="button-primary" tabindex="21" name="cpt_submit" value="<?php echo $cpt_submit_name; ?>" />
1447
- </p>
1448
 
1449
- </form>
1450
- </td>
1451
- <?php //BEGIN TAXONOMY SIDE ?>
1452
- <td width="50%" valign="top">
1453
- <?php
1454
- //debug area
1455
- $cpt_options = get_option('cpt_custom_tax_types');
1456
- ?>
1457
- <p><?php _e( 'If you are unfamiliar with the options below only fill out the <strong>Taxonomy Name</strong> and <strong>Post Type Name</strong> fields. The other settings are set to the most common defaults for custom taxonomies. Hover over the question mark for more details.', 'cpt-plugin' );?></p>
1458
- <form method="post" <?php echo $RETURN_URL; ?>>
1459
- <?php if ( function_exists('wp_nonce_field') )
1460
- wp_nonce_field('cpt_add_custom_taxonomy'); ?>
1461
- <?php if (isset($_GET['edittax'])) { ?>
1462
- <input type="hidden" name="cpt_edit_tax" value="<?php echo $editTax; ?>" />
1463
- <?php } ?>
1464
- <table class="form-table">
1465
- <tr valign="top">
1466
- <th scope="row"><?php _e('Taxonomy Name', 'cpt-plugin') ?> <span class="required">*</span> <a href="#" title="<?php esc_attr_e( 'The taxonomy name. Used to retrieve custom taxonomy content. Should be short and sweet', 'cpt-plugin' ); ?>" class="help">?</a>
1467
- <p><?php _e('Note: Changing the name, after adding terms to the taxonomy, will not update the terms in the database.', 'cpt-plugin' ); ?></p>
1468
- </th>
1469
- <td><input type="text" name="cpt_custom_tax[name]" maxlength="32" onblur="this.value=this.value.toLowerCase()" tabindex="21" value="<?php if (isset($cpt_tax_name)) { echo esc_attr($cpt_tax_name); } ?>" /> <?php _e( '(e.g. actors)', 'cpt-plugin' ); ?>
1470
- <p><strong><?php _e( 'Max 32 characters, should only contain alphanumeric lowercase characters and underscores in place of spaces.', 'cpt-plugin' ); ?></strong></p>
1471
- </td>
1472
- </tr>
1473
-
1474
- <tr valign="top">
1475
- <th scope="row"><?php _e('Label', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Taxonomy label. Used in the admin menu for displaying custom taxonomy.', 'cpt-plugin' ); ?>" class="help">?</a></th>
1476
- <td><input type="text" name="cpt_custom_tax[label]" tabindex="22" value="<?php if (isset($cpt_tax_label)) { echo esc_attr( $cpt_tax_label ); } ?>" /> <?php _e( '(e.g. Actors)', 'cpt-plugin' ); ?></td>
1477
- </tr>
1478
-
1479
- <tr valign="top">
1480
- <th scope="row"><?php _e('Singular Label', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Taxonomy Singular label. Used in WordPress when a singular label is needed.', 'cpt-plugin' ); ?>" class="help">?</a></th>
1481
- <td><input type="text" name="cpt_custom_tax[singular_label]" tabindex="23" value="<?php if (isset($cpt_singular_label_tax)) { echo esc_attr( $cpt_singular_label_tax ); } ?>" /> <?php _e( '(e.g. Actor)', 'cpt-plugin' ); ?></td>
1482
- </tr>
1483
-
1484
- <tr valign="top">
1485
- <th scope="row"><?php _e('Attach to Post Type', 'cpt-plugin') ?> <span class="required">*</span> <a href="#" title="<?php esc_attr_e ('What post type object to attach the custom taxonomy to. Can be post, page, or link by default. Can also be any custom post type name.', 'cpt-plugin' ); ?>" class="help">?</a></th>
1486
- <td>
1487
- <?php if ( isset( $cpt_tax_object_type ) ) { ?>
1488
- <strong><?php _e( 'This is the old method. Delete the post type from the textbox and check which post type to attach this taxonomy to</strong>', 'cpt-plugin' ); ?>
1489
- <input type="text" name="cpt_custom_tax[cpt_name]" tabindex="24" value="<?php if (isset($cpt_tax_object_type)) { echo esc_attr($cpt_tax_object_type); } ?>" /> <?php _e( '(e.g. movies)', 'cpt-plugin' ); ?>
1490
- <?php } ?>
1491
- <?php
1492
- $args=array(
1493
- 'public' => true
1494
- );
1495
- $output = 'objects'; // or objects
1496
- $post_types=get_post_types($args,$output);
1497
- foreach ($post_types as $post_type ) {
1498
- if ( $post_type->name != 'attachment' ) {
1499
- ?>
1500
- <input type="checkbox" name="cpt_post_types[]" tabindex="20" value="<?php echo $post_type->name; ?>" <?php if (isset($cpt_post_types) && is_array($cpt_post_types)) { if (in_array($post_type->name, $cpt_post_types)) { echo 'checked="checked"'; } } ?> />&nbsp;<?php echo $post_type->label; ?><br />
1501
- <?php
1502
- }
1503
- }
1504
- ?>
1505
- </td>
1506
- </tr>
1507
-
1508
- <tr valign="top">
1509
- <td colspan="2">
1510
- <p align="center">
1511
- <?php echo '<a href="#" class="comment_button" id="3">' . __('Advanced Label Options', 'cpt-plugin') . '</a>'; ?> |
1512
- <?php echo '<a href="#" class="comment_button" id="4">' . __('Advanced Options', 'cpt-plugin') . '</a>'; ?>
1513
- </p>
1514
- </td>
1515
- </tr>
1516
-
1517
- </table>
1518
-
1519
- <div style="display:none;" id="slidepanel3">
1520
- <p><?php _e('Below are the advanced label options for custom taxonomies. If you are unfamiliar with these labels the plugin will automatically create labels based off of your custom taxonomy name', 'cpt-plugin'); ?></p>
1521
- <table class="form-table">
1522
- <tr valign="top">
1523
- <th scope="row"><?php _e('Search Items', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'cpt-plugin' ); ?>" class="help">?</a></th>
1524
- <td><input type="text" name="cpt_tax_labels[search_items]" tabindex="2" value="<?php if (isset($cpt_tax_labels["search_items"])) { echo esc_attr($cpt_tax_labels["search_items"]); } ?>" /><br/>
1525
- <?php _e('(e.g. Search Actors)', 'cpt-plugin' ); ?></td>
1526
- </tr>
1527
-
1528
- <tr valign="top">
1529
- <th scope="row"><?php _e('Popular Items', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'cpt-plugin' ); ?>" class="help">?</a></th>
1530
- <td><input type="text" name="cpt_tax_labels[popular_items]" tabindex="2" value="<?php if (isset($cpt_tax_labels["popular_items"])) { echo esc_attr($cpt_tax_labels["popular_items"]); } ?>" /><br/>
1531
- <?php _e('(e.g. Popular Actors)', 'cpt-plugin' ); ?></td>
1532
- </tr>
1533
-
1534
- <tr valign="top">
1535
- <th scope="row"><?php _e('All Items', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'cpt-plugin' ); ?>" class="help">?</a></th>
1536
- <td><input type="text" name="cpt_tax_labels[all_items]" tabindex="2" value="<?php if (isset($cpt_tax_labels["all_items"])) { echo esc_attr($cpt_tax_labels["all_items"]); } ?>" /><br/>
1537
- <?php _e('(e.g. All Actors)', 'cpt-plugin' ); ?></td>
1538
- </tr>
1539
-
1540
- <tr valign="top">
1541
- <th scope="row"><?php _e('Parent Item', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'cpt-plugin' ); ?>" class="help">?</a></th>
1542
- <td><input type="text" name="cpt_tax_labels[parent_item]" tabindex="2" value="<?php if (isset($cpt_tax_labels["parent_item"])) { echo esc_attr($cpt_tax_labels["parent_item"]); } ?>" /><br/>
1543
- <?php _e('(e.g. Parent Actor)', 'cpt-plugin' ); ?></td>
1544
- </tr>
1545
-
1546
- <tr valign="top">
1547
- <th scope="row"><?php _e('Parent Item Colon', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'cpt-plugin' ); ?>" class="help">?</a></th>
1548
- <td><input type="text" name="cpt_tax_labels[parent_item_colon]" tabindex="2" value="<?php if (isset($cpt_tax_labels["parent_item_colon"])) { echo esc_attr($cpt_tax_labels["parent_item_colon"]); } ?>" /><br/>
1549
- <?php _e('(e.g. Parent Actor:)', 'cpt-plugin' ); ?></td>
1550
- </tr>
1551
-
1552
- <tr valign="top">
1553
- <th scope="row"><?php _e('Edit Item', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'cpt-plugin' ); ?>" class="help">?</a></th>
1554
- <td><input type="text" name="cpt_tax_labels[edit_item]" tabindex="2" value="<?php if (isset($cpt_tax_labels["edit_item"])) { echo esc_attr($cpt_tax_labels["edit_item"]); } ?>" /><br/>
1555
- <?php _e( '(e.g. Edit Actor)', 'cpt-plugin' ); ?></td>
1556
- </tr>
1557
-
1558
- <tr valign="top">
1559
- <th scope="row"><?php _e('Update Item', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'cpt-plugin' ); ?>" class="help">?</a></th>
1560
- <td><input type="text" name="cpt_tax_labels[update_item]" tabindex="2" value="<?php if (isset($cpt_tax_labels["update_item"])) { echo esc_attr($cpt_tax_labels["update_item"]); } ?>" /><br/>
1561
- <?php _e( '(e.g. Update Actor)', 'cpt-plugin' ); ?></td>
1562
- </tr>
1563
-
1564
- <tr valign="top">
1565
- <th scope="row"><?php _e('Add New Item', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'cpt-plugin' ); ?>" class="help">?</a></th>
1566
- <td><input type="text" name="cpt_tax_labels[add_new_item]" tabindex="2" value="<?php if (isset($cpt_tax_labels["add_new_item"])) { echo esc_attr($cpt_tax_labels["add_new_item"]); } ?>" /><br/>
1567
- <?php _e( '(e.g. Add New Actor)', 'cpt-plugin' ); ?></td>
1568
- </tr>
1569
-
1570
- <tr valign="top">
1571
- <th scope="row"><?php _e('New Item Name', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'cpt-plugin' ); ?>" class="help">?</a></th>
1572
- <td><input type="text" name="cpt_tax_labels[new_item_name]" tabindex="2" value="<?php if (isset($cpt_tax_labels["new_item_name"])) { echo esc_attr($cpt_tax_labels["new_item_name"]); } ?>" /><br/>
1573
- <?php _e( '(e.g. New Actor Name)', 'cpt-plugin' ); ?></td>
1574
- </tr>
1575
-
1576
- <tr valign="top">
1577
- <th scope="row"><?php _e('Separate Items with Commas', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'cpt-plugin' ); ?>" class="help">?</a></th>
1578
- <td><input type="text" name="cpt_tax_labels[separate_items_with_commas]" tabindex="2" value="<?php if (isset($cpt_tax_labels["separate_items_with_commas"])) { echo esc_attr($cpt_tax_labels["separate_items_with_commas"]); } ?>" /><br/>
1579
- <?php _e( '(e.g. Separate actors with commas)', 'cpt-plugin' ); ?></td>
1580
- </tr>
1581
-
1582
- <tr valign="top">
1583
- <th scope="row"><?php _e('Add or Remove Items', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'cpt-plugin' ); ?>" class="help">?</a></th>
1584
- <td><input type="text" name="cpt_tax_labels[add_or_remove_items]" tabindex="2" value="<?php if (isset($cpt_tax_labels["add_or_remove_items"])) { echo esc_attr($cpt_tax_labels["add_or_remove_items"]); } ?>" /><br/>
1585
- <?php _e( '(e.g. Add or remove actors)', 'cpt-plugin' ); ?></td>
1586
- </tr>
1587
-
1588
- <tr valign="top">
1589
- <th scope="row"><?php _e('Choose From Most Used', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'cpt-plugin' ); ?>" class="help">?</a></th>
1590
- <td><input type="text" name="cpt_tax_labels[choose_from_most_used]" tabindex="2" value="<?php if (isset($cpt_tax_labels["choose_from_most_used"])) { echo esc_attr($cpt_tax_labels["choose_from_most_used"]); } ?>" /><br/>
1591
- <?php _e( '(e.g. Choose from the most used actors)', 'cpt-plugin' ); ?></td>
1592
- </tr>
1593
- </table>
1594
- </div>
1595
-
1596
- <div style="display:none;" id="slidepanel4">
1597
- <table class="form-table">
1598
- <tr valign="top">
1599
- <th scope="row"><?php _e('Hierarchical', 'cpt-plugin') ?> <a href="#" title="<?php esc_attr_e( 'Whether the taxonomy can have parent-child relationships', 'cpt-plugin' ); ?>" class="help">?</a></th>
1600
- <td>
1601
- <select na