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