Version Description
= 0.7.2 = * Added exclude_from_search support * Fixed display bug with capability type * Fixed JavaScript bug * Strict CPT name check * Code cleanup
= 0.7.1 = * XSS security bug patched
= 0.7 = * WordPress 3.1 support * Added has_archive and show_in_menu support * Added label for custom menu name * Updated plugin UI to be consistent with WordPress styles * Added "Get Code" feature to easily copy code used for post types and taxonomies (BETA)
= 0.6.2 = * Added support for assigning custom taxonomies to post types when creating/editing * Fixed bug when setting hierarchy on a post type (props @JohnPBloch) * Fixed an error when registering a post type with no supported meta boxes * Fixed "Undefined index" error when determining return URLs * Added Chinese translation
= 0.6.1 = * Added translation functionality and .pot file * Added Japanese translation * Reworked entire path structure fixing "page not found" errors * Fixed "First argument is expected to be a valid callback" error * Random bug fixes
= 0.6 = * Added support for custom labels with custom post types and taxonomies * Added ability to assign built-in taxonomies to custom post types * Added ability to assign custom taxonomies to multiple post types * Fixed jQuery conflict with other plugins (props shadyvb) * Managing post types now displays total published/draft per type * Code optimization and cleanup
= 0.5.2 = * Updated excerpts to excerpt in CPT Support field (props vlad27aug)
= 0.5.1 = * Added flush_rewrite_rules() to reset rules when using custom rewrite slugs
= 0.5 = * Fixed multiple bugs * If upgrading from pre 0.5 version you will need to recreate your custom post types
= 0.4.1 = * Fixed bug with REWRITE and QUERY_VAR values not executing correctly
= 0.4 = * Default view now hides advanced options * Get Code link to easily copy/paste code used to create custom post types and taxonomies * Added support for 'author' and 'page-attributes' in CPT Supports field
= 0.3.1 = * Fixed multiple warnings and errors
= 0.3 = * added new menu/submenus for individual sections * added support for 'title' and 'editor' in CPT Supports field * added Singular Label for custom taxonomies (props sleary)
= 0.2.1 = * Set default Query Var setting to False
= 0.2 = * Fixed the siteurl bug * Added support for creating custom taxonomies
= 0.1.2 = * Fixed a bug where default values were incorrect
= 0.1.1 = * Fixed a bunch of warnings
= 0.1 = * First beta release
Release Info
Developer | tw2113 |
Plugin | Custom Post Type UI |
Version | 0.8.0.0 |
Comparing to | |
See all releases |
Code changes from version 0.7.2.0 to 0.8.0.0
- README.md +4 -0
- custom-post-type-ui.php +1001 -912
- images/professional-wordpress-secondedition.jpg +0 -0
- languages/custom-post-type-ui.mo +0 -0
- readme.txt +34 -9
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- screenshot-3.png +0 -0
- screenshot-4.png +0 -0
- screenshot-5.png +0 -0
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
custom-post-type-ui
|
2 |
+
===================
|
3 |
+
|
4 |
+
Admin UI for creating custom post types and custom taxonomies in WordPress
|
@@ -1,15 +1,17 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Custom Post Type UI
|
4 |
-
Plugin URI: http://webdevstudios.com/
|
5 |
Description: Admin panel for creating custom post types and custom taxonomies in WordPress
|
6 |
Author: WebDevStudios.com
|
7 |
-
Version: 0.
|
8 |
Author URI: http://webdevstudios.com/
|
|
|
|
|
9 |
*/
|
10 |
|
11 |
// Define current version constant
|
12 |
-
define( 'CPT_VERSION', '0.
|
13 |
|
14 |
// Define plugin URL constant
|
15 |
$CPT_URL = cpt_check_return( 'add' );
|
@@ -32,14 +34,24 @@ add_action( 'init', 'cpt_create_custom_taxonomies', 0 );
|
|
32 |
//process custom taxonomies if they exist
|
33 |
add_action( 'init', 'cpt_create_custom_post_types', 0 );
|
34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
function cpt_plugin_menu() {
|
36 |
//create custom post type menu
|
37 |
-
add_menu_page('Custom Post Types', 'Custom Post Types', '
|
38 |
|
39 |
//create submenu items
|
40 |
-
add_submenu_page('cpt_main_menu', 'Add New', 'Add New', '
|
41 |
-
add_submenu_page('cpt_main_menu', 'Manage Post Types', 'Manage Post Types', '
|
42 |
-
add_submenu_page('cpt_main_menu', 'Manage Taxonomies', 'Manage Taxonomies', '
|
43 |
}
|
44 |
|
45 |
//temp fix, should do: http://planetozh.com/blog/2008/04/how-to-load-javascript-with-your-wordpress-plugin/
|
@@ -50,27 +62,21 @@ if ( strpos( $_SERVER['REQUEST_URI'], 'cpt' ) > 0 ) {
|
|
50 |
|
51 |
// Add JS Scripts
|
52 |
function cpt_wp_add_styles() {
|
53 |
-
|
54 |
-
wp_enqueue_script( 'jquery' );
|
55 |
-
?>
|
56 |
|
57 |
-
|
58 |
-
jQuery(document).ready(function()
|
59 |
-
{
|
60 |
-
jQuery(".comment_button").click(function(){
|
61 |
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
|
|
67 |
|
68 |
return false;
|
69 |
-
|
70 |
});
|
71 |
});
|
72 |
-
|
73 |
-
|
74 |
}
|
75 |
|
76 |
function cpt_create_custom_post_types() {
|
@@ -85,23 +91,25 @@ function cpt_create_custom_post_types() {
|
|
85 |
$cpt_label = ( !$cpt_post_type["label"] ) ? esc_html($cpt_post_type["name"]) : esc_html($cpt_post_type["label"]);
|
86 |
$cpt_singular = ( !$cpt_post_type["singular_label"] ) ? $cpt_label : esc_html($cpt_post_type["singular_label"]);
|
87 |
$cpt_rewrite_slug = ( !$cpt_post_type["rewrite_slug"] ) ? esc_html($cpt_post_type["name"]) : esc_html($cpt_post_type["rewrite_slug"]);
|
|
|
88 |
$cpt_menu_position = ( !$cpt_post_type["menu_position"] ) ? null : intval($cpt_post_type["menu_position"]);
|
|
|
89 |
$cpt_taxonomies = ( !$cpt_post_type[1] ) ? array() : $cpt_post_type[1];
|
90 |
$cpt_supports = ( !$cpt_post_type[0] ) ? array() : $cpt_post_type[0];
|
91 |
//$cpt_show_in_menu = ( !$cpt_post_type["show_in_menu_string"] ) ? null : $cpt_post_type["show_in_menu_string"];
|
92 |
|
93 |
if ( isset ( $cpt_post_type["show_in_menu"] ) ) {
|
94 |
-
|
95 |
-
|
96 |
-
}else{
|
97 |
-
|
98 |
}
|
99 |
//set custom label values
|
100 |
$cpt_labels['name'] = $cpt_label;
|
101 |
$cpt_labels['singular_name'] = $cpt_post_type["singular_label"];
|
102 |
|
103 |
if ( isset ( $cpt_post_type[2]["menu_name"] ) ) {
|
104 |
-
|
105 |
}
|
106 |
|
107 |
$cpt_has_archive = ( isset ( $cpt_post_type["has_archive"] ) ) ? get_disp_boolean( $cpt_post_type["has_archive"] ) : null;
|
@@ -128,10 +136,11 @@ function cpt_create_custom_post_types() {
|
|
128 |
'capability_type' => $cpt_post_type["capability_type"],
|
129 |
'hierarchical' => get_disp_boolean($cpt_post_type["hierarchical"]),
|
130 |
'exclude_from_search' => $cpt_exclude_from_search,
|
131 |
-
'rewrite' => array('slug' => $cpt_rewrite_slug),
|
132 |
'query_var' => get_disp_boolean($cpt_post_type["query_var"]),
|
133 |
'description' => esc_html($cpt_post_type["description"]),
|
134 |
'menu_position' => $cpt_menu_position,
|
|
|
135 |
'supports' => $cpt_supports,
|
136 |
'taxonomies' => $cpt_taxonomies,
|
137 |
'labels' => $cpt_labels
|
@@ -193,10 +202,10 @@ function cpt_delete_post_type() {
|
|
193 |
|
194 |
//check if we are deleting a custom post type
|
195 |
if( isset( $_GET['deltype'] ) ) {
|
196 |
-
|
197 |
//nonce security check
|
198 |
check_admin_referer( 'cpt_delete_post_type' );
|
199 |
-
|
200 |
$delType = intval( $_GET['deltype'] );
|
201 |
$cpt_post_types = get_option( 'cpt_custom_post_types' );
|
202 |
|
@@ -208,7 +217,7 @@ function cpt_delete_post_type() {
|
|
208 |
|
209 |
if ( isset( $_GET['return'] ) ) {
|
210 |
$RETURN_URL = cpt_check_return( esc_attr( $_GET['return'] ) );
|
211 |
-
}else{
|
212 |
$RETURN_URL = $CPT_URL;
|
213 |
}
|
214 |
|
@@ -230,7 +239,7 @@ function cpt_delete_post_type() {
|
|
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 |
|
@@ -274,13 +283,14 @@ function cpt_register_settings() {
|
|
274 |
array_push( $cpt_options, $cpt_form_fields );
|
275 |
|
276 |
$cpt_options = array_values( $cpt_options );
|
|
|
277 |
|
278 |
//save custom post types
|
279 |
update_option( 'cpt_custom_post_types', $cpt_options );
|
280 |
|
281 |
if ( isset( $_GET['return'] ) ) {
|
282 |
$RETURN_URL = cpt_check_return( esc_attr( $_GET['return'] ) );
|
283 |
-
}else{
|
284 |
$RETURN_URL = $CPT_URL;
|
285 |
}
|
286 |
|
@@ -288,9 +298,9 @@ function cpt_register_settings() {
|
|
288 |
|
289 |
}
|
290 |
|
291 |
-
}elseif( isset( $_POST['cpt_submit'] ) ) {
|
292 |
//create a new custom post type
|
293 |
-
|
294 |
//nonce security check
|
295 |
check_admin_referer( 'cpt_add_custom_post_type' );
|
296 |
|
@@ -300,7 +310,7 @@ function cpt_register_settings() {
|
|
300 |
if ( empty( $cpt_form_fields["name"] ) ) {
|
301 |
if ( isset( $_GET['return'] ) ) {
|
302 |
$RETURN_URL = cpt_check_return( esc_attr( $_GET['return'] ) );
|
303 |
-
}else{
|
304 |
$RETURN_URL = $CPT_URL;
|
305 |
}
|
306 |
|
@@ -329,13 +339,14 @@ function cpt_register_settings() {
|
|
329 |
|
330 |
//insert new custom post type into the array
|
331 |
array_push( $cpt_options, $cpt_form_fields );
|
|
|
332 |
|
333 |
//save new custom post type array in the CPT option
|
334 |
update_option( 'cpt_custom_post_types', $cpt_options );
|
335 |
|
336 |
if ( isset( $_GET['return'] ) ) {
|
337 |
$RETURN_URL = cpt_check_return( esc_attr( $_GET['return'] ) );
|
338 |
-
}else{
|
339 |
$RETURN_URL = $CPT_URL;
|
340 |
}
|
341 |
|
@@ -344,7 +355,7 @@ function cpt_register_settings() {
|
|
344 |
|
345 |
if ( isset( $_POST['cpt_edit_tax'] ) ) {
|
346 |
//edit a custom taxonomy
|
347 |
-
|
348 |
//nonce security check
|
349 |
check_admin_referer( 'cpt_add_custom_taxonomy' );
|
350 |
|
@@ -377,7 +388,7 @@ function cpt_register_settings() {
|
|
377 |
|
378 |
if ( isset( $_GET['return'] ) ) {
|
379 |
$RETURN_URL = cpt_check_return( esc_attr( $_GET['return'] ) );
|
380 |
-
}else{
|
381 |
$RETURN_URL = $CPT_URL;
|
382 |
}
|
383 |
|
@@ -385,9 +396,9 @@ function cpt_register_settings() {
|
|
385 |
|
386 |
}
|
387 |
|
388 |
-
}elseif( isset( $_POST['cpt_add_tax'] ) ) {
|
389 |
//create new custom taxonomy
|
390 |
-
|
391 |
//nonce security check
|
392 |
check_admin_referer( 'cpt_add_custom_taxonomy' );
|
393 |
|
@@ -398,23 +409,23 @@ function cpt_register_settings() {
|
|
398 |
if ( empty( $cpt_form_fields["name"] ) ) {
|
399 |
if ( isset( $_GET['return'] ) ) {
|
400 |
$RETURN_URL = cpt_check_return( esc_attr( $_GET['return'] ) );
|
401 |
-
}
|
402 |
$RETURN_URL = $CPT_URL;
|
403 |
}
|
404 |
|
405 |
wp_redirect( $RETURN_URL .'&cpt_error=2' );
|
406 |
exit();
|
407 |
-
|
408 |
-
}elseif ( empty( $_POST['cpt_post_types'] ) ) {
|
409 |
if ( isset( $_GET['return'] ) ) {
|
410 |
$RETURN_URL = cpt_check_return( esc_attr( $_GET['return'] ) );
|
411 |
-
}else{
|
412 |
$RETURN_URL = $CPT_URL;
|
413 |
}
|
414 |
|
415 |
wp_redirect( $RETURN_URL .'&cpt_error=3' );
|
416 |
exit();
|
417 |
-
|
418 |
}
|
419 |
|
420 |
//add label values to array
|
@@ -439,7 +450,7 @@ function cpt_register_settings() {
|
|
439 |
|
440 |
if ( isset( $_GET['return'] ) ) {
|
441 |
$RETURN_URL = cpt_check_return( esc_attr( $_GET['return'] ) );
|
442 |
-
}else{
|
443 |
$RETURN_URL = $CPT_URL;
|
444 |
}
|
445 |
|
@@ -455,65 +466,62 @@ function cpt_settings() {
|
|
455 |
//flush rewrite rules
|
456 |
flush_rewrite_rules();
|
457 |
?>
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
<
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
<
|
471 |
-
|
472 |
-
|
473 |
-
<
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
<
|
478 |
-
<
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
echo '</div>';
|
515 |
-
?>
|
516 |
-
</div>
|
517 |
<?php
|
518 |
//load footer
|
519 |
cpt_footer();
|
@@ -529,54 +537,56 @@ function cpt_manage_cpt() {
|
|
529 |
<div class="wrap">
|
530 |
<?php
|
531 |
//check for success/error messages
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
}
|
538 |
?>
|
539 |
<?php screen_icon( 'plugins' ); ?>
|
540 |
<h2><?php _e('Manage Custom Post Types', 'cpt-plugin') ?></h2>
|
541 |
-
<p><?php _e('Deleting custom post types
|
542 |
<?php
|
543 |
-
$cpt_post_types = get_option('cpt_custom_post_types');
|
544 |
-
|
|
|
545 |
?>
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
$thecounter=0;
|
579 |
$cpt_names = array();
|
|
|
580 |
foreach ($cpt_post_types as $cpt_post_type) {
|
581 |
|
582 |
$del_url = cpt_check_return( 'cpt' ) .'&deltype=' .$thecounter .'&return=cpt';
|
@@ -589,32 +599,33 @@ If (isset($_GET['cpt_msg']) && $_GET['cpt_msg']=='del') { ?>
|
|
589 |
|
590 |
$rewrite_slug = ( $cpt_post_type["rewrite_slug"] ) ? $cpt_post_type["rewrite_slug"] : $cpt_post_type["name"];
|
591 |
?>
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
<?php
|
605 |
-
|
606 |
foreach ($cpt_post_type[0] as $cpt_supports) {
|
607 |
echo $cpt_supports .'<br />';
|
608 |
}
|
609 |
}
|
610 |
?>
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
|
|
618 |
$custom_post_type='';
|
619 |
$cpt_support_array='';
|
620 |
$cpt_tax_array='';
|
@@ -623,6 +634,7 @@ If (isset($_GET['cpt_msg']) && $_GET['cpt_msg']=='del') { ?>
|
|
623 |
$cpt_singular = ( !$cpt_post_type["singular_label"] ) ? $cpt_label : esc_html($cpt_post_type["singular_label"]);
|
624 |
$cpt_rewrite_slug = ( !$cpt_post_type["rewrite_slug"] ) ? esc_html($cpt_post_type["name"]) : esc_html($cpt_post_type["rewrite_slug"]);
|
625 |
$cpt_menu_position = ( !$cpt_post_type["menu_position"] ) ? null : intval($cpt_post_type["menu_position"]);
|
|
|
626 |
$cpt_show_in_menu = ( $cpt_post_type["show_in_menu"] == 1 ) ? 'true' : 'false';
|
627 |
$cpt_show_in_menu = ( $cpt_post_type["show_in_menu_string"] ) ? '\''.$cpt_post_type["show_in_menu_string"].'\'' : $cpt_show_in_menu;
|
628 |
|
@@ -655,130 +667,132 @@ If (isset($_GET['cpt_msg']) && $_GET['cpt_msg']=='del') { ?>
|
|
655 |
$cpt_tax_array .= '\''.$cpt_taxes.'\',';
|
656 |
}
|
657 |
}
|
658 |
-
|
659 |
-
$custom_post_type
|
660 |
-
$custom_post_type .=
|
661 |
-
$custom_post_type .=
|
662 |
-
$custom_post_type .=
|
663 |
-
$custom_post_type .=
|
664 |
-
$custom_post_type .=
|
665 |
-
$custom_post_type .=
|
666 |
-
$custom_post_type .=
|
667 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
668 |
|
669 |
if ( $cpt_post_type["has_archive"] ) {
|
670 |
-
|
671 |
}
|
672 |
|
673 |
if ( isset( $cpt_post_type["exclude_from_search"] ) ) {
|
674 |
-
|
675 |
}
|
676 |
-
|
677 |
if ( $cpt_post_type["menu_position"] ) {
|
678 |
-
|
679 |
}
|
680 |
|
681 |
-
|
|
|
|
|
|
|
|
|
682 |
|
683 |
if ( $cpt_tax_array ) {
|
684 |
-
$custom_post_type .=
|
685 |
}
|
686 |
|
687 |
if ( $cpt_labels ) {
|
688 |
-
$custom_post_type .=
|
689 |
}
|
690 |
|
691 |
-
$custom_post_type .=
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
echo '<textarea rows="5" cols="100">' .$custom_post_type .'</textarea>';
|
696 |
|
697 |
-
|
698 |
-
|
699 |
</td>
|
700 |
-
|
701 |
<?php
|
702 |
$thecounter++;
|
703 |
$cpt_names[] = strtolower( $cpt_post_type["name"] );
|
704 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
705 |
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
?></table>
|
715 |
-
<?php screen_icon( 'plugins' ); ?>
|
716 |
-
<h2><?php _e('Additional Custom Post Types', 'cpt-plugin') ?></h2>
|
717 |
-
<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>
|
718 |
-
<?php
|
719 |
-
foreach ($post_types as $post_type ) {
|
720 |
-
|
721 |
-
if ( !in_array( strtolower( $post_type->name ), $cpt_names ) ) {
|
722 |
-
if ( isset( $cpt_first ) && !$cpt_first ) {
|
723 |
-
?>
|
724 |
-
<table width="100%" class="widefat">
|
725 |
-
<thead>
|
726 |
-
<tr>
|
727 |
-
<th><?php _e('Name', 'cpt-plugin');?></th>
|
728 |
-
<th><?php _e('Label', 'cpt-plugin');?></th>
|
729 |
-
<th><?php _e('Singular Label', 'cpt-plugin');?></th>
|
730 |
-
<th><?php _e('Public', 'cpt-plugin');?></th>
|
731 |
-
<th><?php _e('Show UI', 'cpt-plugin');?></th>
|
732 |
-
<th><?php _e('Capability Type', 'cpt-plugin');?></th>
|
733 |
-
<th><?php _e('Hierarchical', 'cpt-plugin');?></th>
|
734 |
-
<th><?php _e('Rewrite Slug', 'cpt-plugin');?></th>
|
735 |
-
<th><?php _e('Rewrite Slug', 'cpt-plugin');?></th>
|
736 |
-
<th><?php _e('Query Var', 'cpt-plugin');?></th>
|
737 |
-
</tr>
|
738 |
-
</thead>
|
739 |
-
<tfoot>
|
740 |
-
<tr>
|
741 |
-
<th><?php _e('Name', 'cpt-plugin');?></th>
|
742 |
-
<th><?php _e('Label', 'cpt-plugin');?></th>
|
743 |
-
<th><?php _e('Singular Label', 'cpt-plugin');?></th>
|
744 |
-
<th><?php _e('Public', 'cpt-plugin');?></th>
|
745 |
-
<th><?php _e('Show UI', 'cpt-plugin');?></th>
|
746 |
-
<th><?php _e('Capability Type', 'cpt-plugin');?></th>
|
747 |
-
<th><?php _e('Hierarchical', 'cpt-plugin');?></th>
|
748 |
-
<th><?php _e('Rewrite Slug', 'cpt-plugin');?></th>
|
749 |
-
<th><?php _e('Rewrite Slug', 'cpt-plugin');?></th>
|
750 |
-
<th><?php _e('Query Var', 'cpt-plugin');?></th>
|
751 |
-
</tr>
|
752 |
-
</tfoot>
|
753 |
-
<?php
|
754 |
-
$cpt_first = true;
|
755 |
-
}
|
756 |
-
$rewrite_slug = ( isset( $post_type->rewrite_slug ) ) ? $post_type->rewrite_slug : $post_type->name;
|
757 |
-
?>
|
758 |
-
<tr>
|
759 |
-
<td valign="top"><?php echo $post_type->name; ?></td>
|
760 |
-
<td valign="top"><?php echo $post_type->label; ?></td>
|
761 |
-
<td valign="top"><?php echo $post_type->singular_label; ?></td>
|
762 |
-
<td valign="top"><?php echo disp_boolean($post_type->public); ?></td>
|
763 |
-
<td valign="top"><?php echo disp_boolean($post_type->show_ui); ?></td>
|
764 |
-
<td valign="top"><?php echo $post_type->capability_type; ?></td>
|
765 |
-
<td valign="top"><?php echo disp_boolean($post_type->hierarchical); ?></td>
|
766 |
-
<td valign="top"><?php echo disp_boolean($post_type->rewrite); ?></td>
|
767 |
-
<td valign="top"><?php echo $rewrite_slug; ?></td>
|
768 |
-
<td valign="top"><?php echo disp_boolean($post_type->query_var); ?></td>
|
769 |
-
</tr>
|
770 |
-
<?php
|
771 |
-
}
|
772 |
-
}
|
773 |
-
}
|
774 |
-
|
775 |
-
if ( isset($cpt_first) && !$cpt_first ) {
|
776 |
-
echo '<tr><td><strong>';
|
777 |
-
_e( 'No additional post types found', 'cpt-plugin' );
|
778 |
-
echo '</strong></td></tr>';
|
779 |
-
}
|
780 |
-
?>
|
781 |
-
</table>
|
782 |
|
783 |
</div><?php
|
784 |
//load footer
|
@@ -796,49 +810,49 @@ function cpt_manage_taxonomies() {
|
|
796 |
<div class="wrap">
|
797 |
<?php
|
798 |
//check for success/error messages
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
}
|
805 |
?>
|
806 |
<?php screen_icon( 'plugins' ); ?>
|
807 |
<h2><?php _e('Manage Custom Taxonomies', 'cpt-plugin') ?></h2>
|
808 |
<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>
|
809 |
<?php
|
810 |
-
$cpt_tax_types = get_option('cpt_custom_tax_types');
|
811 |
|
812 |
-
|
813 |
?>
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
$thecounter=0;
|
843 |
foreach ($cpt_tax_types as $cpt_tax_type) {
|
844 |
|
@@ -850,76 +864,76 @@ If (isset($_GET['cpt_msg']) && $_GET['cpt_msg']=='del') { ?>
|
|
850 |
|
851 |
$rewrite_slug = ( $cpt_tax_type["rewrite_slug"] ) ? $cpt_tax_type["rewrite_slug"] : $cpt_tax_type["name"];
|
852 |
?>
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
<?php
|
860 |
if ( isset( $cpt_tax_type["cpt_name"] ) ) {
|
861 |
echo stripslashes($cpt_tax_type["cpt_name"]);
|
862 |
-
}elseif ( is_array( $cpt_tax_type[1] ) ) {
|
863 |
foreach ($cpt_tax_type[1] as $cpt_post_types) {
|
864 |
echo $cpt_post_types .'<br />';
|
865 |
}
|
866 |
}
|
867 |
?>
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
|
912 |
echo '<br>';
|
913 |
echo _e('Place the below code in your themes functions.php file to manually create this custom taxonomy','cpt-plugin').'<br>';
|
914 |
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>';
|
915 |
-
|
916 |
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
</td>
|
922 |
-
|
923 |
<?php
|
924 |
$thecounter++;
|
925 |
}
|
@@ -935,595 +949,670 @@ If (isset($_GET['cpt_msg']) && $_GET['cpt_msg']=='del') { ?>
|
|
935 |
function cpt_add_new() {
|
936 |
global $cpt_error, $CPT_URL;
|
937 |
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
942 |
}
|
943 |
|
|
|
|
|
944 |
|
945 |
-
//
|
946 |
-
|
947 |
-
check_admin_referer('cpt_edit_post_type');
|
948 |
-
|
949 |
-
//get post type to edit
|
950 |
-
$editType = intval($_GET['edittype']);
|
951 |
-
|
952 |
-
//load custom posts saved in WP
|
953 |
-
$cpt_options = get_option('cpt_custom_post_types');
|
954 |
-
|
955 |
-
//load custom post type values to edit
|
956 |
-
$cpt_post_type_name = $cpt_options[$editType]["name"];
|
957 |
-
$cpt_label = $cpt_options[$editType]["label"];
|
958 |
-
$cpt_singular_label = $cpt_options[$editType]["singular_label"];
|
959 |
-
$cpt_public = $cpt_options[$editType]["public"];
|
960 |
-
$cpt_showui = $cpt_options[$editType]["show_ui"];
|
961 |
-
$cpt_capability = $cpt_options[$editType]["capability_type"];
|
962 |
-
$cpt_hierarchical = $cpt_options[$editType]["hierarchical"];
|
963 |
-
$cpt_rewrite = $cpt_options[$editType]["rewrite"];
|
964 |
-
$cpt_rewrite_slug = $cpt_options[$editType]["rewrite_slug"];
|
965 |
-
$cpt_query_var = $cpt_options[$editType]["query_var"];
|
966 |
-
$cpt_description = $cpt_options[$editType]["description"];
|
967 |
-
$cpt_menu_position = $cpt_options[$editType]["menu_position"];
|
968 |
-
$cpt_supports = $cpt_options[$editType][0];
|
969 |
-
$cpt_taxes = $cpt_options[$editType][1];
|
970 |
-
$cpt_labels = $cpt_options[$editType][2];
|
971 |
-
$cpt_has_archive = ( isset( $cpt_options[$editType]["has_archive"] ) ) ? $cpt_options[$editType]["has_archive"] : null;
|
972 |
-
$cpt_exclude_from_search = ( isset( $cpt_options[$editType]["exclude_from_search"] ) ) ? $cpt_options[$editType]["exclude_from_search"] : null;
|
973 |
-
$cpt_show_in_menu = ( isset( $cpt_options[$editType]["show_in_menu"] ) ) ? $cpt_options[$editType]["show_in_menu"] : null;
|
974 |
-
$cpt_show_in_menu_string = ( isset( $cpt_options[$editType]["show_in_menu_string"] ) ) ? $cpt_options[$editType]["show_in_menu_string"] : null;
|
975 |
-
|
976 |
-
$cpt_submit_name = 'Save Custom Post Type';
|
977 |
-
}Else{
|
978 |
-
$cpt_submit_name = 'Create Custom Post Type';
|
979 |
-
}
|
980 |
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
$cpt_post_types = $cpt_options[$editTax][1];
|
1002 |
-
|
1003 |
-
$cpt_tax_submit_name = 'Save Custom Taxonomy';
|
1004 |
-
}Else{
|
1005 |
-
$cpt_tax_submit_name = 'Create Custom Taxonomy';
|
1006 |
-
}
|
1007 |
|
1008 |
-
//flush rewrite rules
|
1009 |
-
flush_rewrite_rules();
|
1010 |
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
<th scope="row"><?php _e('Label', 'cpt-plugin') ?></th>
|
1068 |
-
<td><input type="text" name="cpt_custom_post_type[label]" tabindex="2" value="<?php If (isset($cpt_label)) { echo esc_attr($cpt_label); } ?>" /> <a href="#" title="Post type label. Used in the admin menu for displaying post types." style="cursor: help;">?</a> (e.g. Movies)</td>
|
1069 |
-
</tr>
|
1070 |
-
|
1071 |
-
<tr valign="top">
|
1072 |
-
<th scope="row"><?php _e('Singular Label', 'cpt-plugin') ?></th>
|
1073 |
-
<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); } ?>" /> <a href="#" title="Custom Post Type Singular label. Used in WordPress when a singular label is needed." style="cursor: help;">?</a> (e.g. Movie)</td>
|
1074 |
-
|
1075 |
-
</tr>
|
1076 |
-
|
1077 |
-
<tr valign="top">
|
1078 |
-
<th scope="row"><?php _e('Description', 'cpt-plugin') ?></th>
|
1079 |
-
<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><a href="#" title="Custom Post Type Description. Describe what your custom post type is used for." style="cursor: help;">?</a></td>
|
1080 |
-
</tr>
|
1081 |
-
|
1082 |
-
<tr valign="top">
|
1083 |
-
<td colspan="2">
|
1084 |
-
<p align="center">
|
1085 |
-
<?php echo '<a href="#" class="comment_button" id="1">' . __('Advanced Label Options', 'cpt-plugin') . '</a>'; ?> ·
|
1086 |
-
<?php echo '<a href="#" class="comment_button" id="2">' . __('Advanced Options', 'cpt-plugin') . '</a>'; ?>
|
1087 |
-
</p>
|
1088 |
-
</td>
|
1089 |
-
</tr>
|
1090 |
-
|
1091 |
-
</table>
|
1092 |
-
|
1093 |
-
<div style="display:none;" id="slidepanel1">
|
1094 |
-
<p><?php _e('Below are the advanced label options for custom post types. If you are unfamiliar with these labels the plugin will automatically create labels based off of your custom post type name', 'cpt-plugin'); ?></p>
|
1095 |
-
<table class="form-table">
|
1096 |
-
|
1097 |
-
<tr valign="top">
|
1098 |
-
<th scope="row"><?php _e('Menu Name', 'cpt-plugin') ?></th>
|
1099 |
-
<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"]); } ?>" /> <a href="#" title="Custom menu name for your custom post type." style="cursor: help;">?</a> (e.g. My Movies)</td>
|
1100 |
-
</tr>
|
1101 |
-
|
1102 |
-
<tr valign="top">
|
1103 |
-
<th scope="row"><?php _e('Add New', 'cpt-plugin') ?></th>
|
1104 |
-
<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"]); } ?>" /> <a href="#" title="Post type label. Used in the admin menu for displaying post types." style="cursor: help;">?</a> (e.g. Add New)</td>
|
1105 |
-
</tr>
|
1106 |
-
|
1107 |
-
<tr valign="top">
|
1108 |
-
<th scope="row"><?php _e('Add New Item', 'cpt-plugin') ?></th>
|
1109 |
-
<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"]); } ?>" /> <a href="#" title="Post type label. Used in the admin menu for displaying post types." style="cursor: help;">?</a> (e.g. Add New Movie)</td>
|
1110 |
-
</tr>
|
1111 |
-
|
1112 |
-
<tr valign="top">
|
1113 |
-
<th scope="row"><?php _e('Edit', 'cpt-plugin') ?></th>
|
1114 |
-
<td><input type="text" name="cpt_labels[edit]" tabindex="2" value="<?php If (isset($cpt_labels["edit"])) { echo esc_attr($cpt_labels["edit"]); } ?>" /> <a href="#" title="Post type label. Used in the admin menu for displaying post types." style="cursor: help;">?</a> (e.g. Edit)</td>
|
1115 |
-
</tr>
|
1116 |
-
|
1117 |
-
<tr valign="top">
|
1118 |
-
<th scope="row"><?php _e('Edit Item', 'cpt-plugin') ?></th>
|
1119 |
-
<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"]); } ?>" /> <a href="#" title="Post type label. Used in the admin menu for displaying post types." style="cursor: help;">?</a> (e.g. Edit Movie)</td>
|
1120 |
-
</tr>
|
1121 |
-
|
1122 |
-
<tr valign="top">
|
1123 |
-
<th scope="row"><?php _e('New Item', 'cpt-plugin') ?></th>
|
1124 |
-
<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"]); } ?>" /> <a href="#" title="Post type label. Used in the admin menu for displaying post types." style="cursor: help;">?</a> (e.g. New Movie)</td>
|
1125 |
-
</tr>
|
1126 |
-
|
1127 |
-
<tr valign="top">
|
1128 |
-
<th scope="row"><?php _e('View', 'cpt-plugin') ?></th>
|
1129 |
-
<td><input type="text" name="cpt_labels[view]" tabindex="2" value="<?php If (isset($cpt_labels["view"])) { echo esc_attr($cpt_labels["view"]); } ?>" /> <a href="#" title="Post type label. Used in the admin menu for displaying post types." style="cursor: help;">?</a> (e.g. View Movie)</td>
|
1130 |
-
</tr>
|
1131 |
-
|
1132 |
-
<tr valign="top">
|
1133 |
-
<th scope="row"><?php _e('View Item', 'cpt-plugin') ?></th>
|
1134 |
-
<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"]); } ?>" /> <a href="#" title="Post type label. Used in the admin menu for displaying post types." style="cursor: help;">?</a> (e.g. View Movie)</td>
|
1135 |
-
</tr>
|
1136 |
-
|
1137 |
-
<tr valign="top">
|
1138 |
-
<th scope="row"><?php _e('Search Items', 'cpt-plugin') ?></th>
|
1139 |
-
<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"]); } ?>" /> <a href="#" title="Post type label. Used in the admin menu for displaying post types." style="cursor: help;">?</a> (e.g. Search Movies)</td>
|
1140 |
-
</tr>
|
1141 |
-
|
1142 |
-
<tr valign="top">
|
1143 |
-
<th scope="row"><?php _e('Not Found', 'cpt-plugin') ?></th>
|
1144 |
-
<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"]); } ?>" /> <a href="#" title="Post type label. Used in the admin menu for displaying post types." style="cursor: help;">?</a> (e.g. No Movies Found)</td>
|
1145 |
-
</tr>
|
1146 |
-
|
1147 |
-
<tr valign="top">
|
1148 |
-
<th scope="row"><?php _e('Not Found in Trash', 'cpt-plugin') ?></th>
|
1149 |
-
<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"]); } ?>" /> <a href="#" title="Post type label. Used in the admin menu for displaying post types." style="cursor: help;">?</a> (e.g. No Movies found in Trash)</td>
|
1150 |
-
</tr>
|
1151 |
-
|
1152 |
-
<tr valign="top">
|
1153 |
-
<th scope="row"><?php _e('Parent', 'cpt-plugin') ?></th>
|
1154 |
-
<td><input type="text" name="cpt_labels[parent]" tabindex="2" value="<?php If (isset($cpt_labels["parent"])) { echo esc_attr($cpt_labels["parent"]); } ?>" /> <a href="#" title="Post type label. Used in the admin menu for displaying post types." style="cursor: help;">?</a> (e.g. Parent Movie)</td>
|
1155 |
-
</tr>
|
1156 |
-
|
1157 |
-
</table>
|
1158 |
-
</div>
|
1159 |
-
|
1160 |
-
<div style="display:none;" id="slidepanel2">
|
1161 |
-
<table class="form-table">
|
1162 |
-
<tr valign="top">
|
1163 |
-
<th scope="row"><?php _e('Public', 'cpt-plugin') ?></th>
|
1164 |
-
<td>
|
1165 |
-
<SELECT name="cpt_custom_post_type[public]" tabindex="4">
|
1166 |
-
<OPTION value="0" <?php If (isset($cpt_public)) { If ($cpt_public == 0 && $cpt_public != '') { echo 'selected="selected"'; } } ?>>False</OPTION>
|
1167 |
-
<OPTION value="1" <?php If (isset($cpt_public)) { If ($cpt_public == 1 || is_null($cpt_public)) { echo 'selected="selected"'; } }Else{ echo 'selected="selected"'; } ?>>True</OPTION>
|
1168 |
-
</SELECT> <a href="#" title="Whether posts of this type should be shown in the admin UI" style="cursor: help;">?</a> (default: True)
|
1169 |
-
</td>
|
1170 |
-
</tr>
|
1171 |
-
|
1172 |
-
<tr valign="top">
|
1173 |
-
<th scope="row"><?php _e('Show UI', 'cpt-plugin') ?></th>
|
1174 |
-
<td>
|
1175 |
-
<SELECT name="cpt_custom_post_type[show_ui]" tabindex="5">
|
1176 |
-
<OPTION value="0" <?php If (isset($cpt_showui)) { If ($cpt_showui == 0 && $cpt_showui != '') { echo 'selected="selected"'; } } ?>>False</OPTION>
|
1177 |
-
<OPTION value="1" <?php If (isset($cpt_showui)) { If ($cpt_showui == 1 || is_null($cpt_showui)) { echo 'selected="selected"'; } }Else{ echo 'selected="selected"'; } ?>>True</OPTION>
|
1178 |
-
</SELECT> <a href="#" title="Whether to generate a default UI for managing this post type" style="cursor: help;">?</a> (default: True)
|
1179 |
-
</td>
|
1180 |
-
</tr>
|
1181 |
-
|
1182 |
-
<tr valign="top">
|
1183 |
-
<th scope="row"><?php _e('Has Archive', 'cpt-plugin') ?></th>
|
1184 |
-
<td>
|
1185 |
-
<SELECT name="cpt_custom_post_type[has_archive]" tabindex="6">
|
1186 |
-
<OPTION value="0" <?php If (isset($cpt_has_archive)) { If ($cpt_has_archive == 0) { echo 'selected="selected"'; } }Else{ echo 'selected="selected"'; } ?>>False</OPTION>
|
1187 |
-
<OPTION value="1" <?php If (isset($cpt_has_archive)) { If ($cpt_has_archive == 1) { echo 'selected="selected"'; } } ?>>True</OPTION>
|
1188 |
-
</SELECT> <a href="#" title="Whether the post type will have a post type archive page" style="cursor: help;">?</a> (default: False)
|
1189 |
-
</td>
|
1190 |
-
</tr>
|
1191 |
-
|
1192 |
-
<tr valign="top">
|
1193 |
-
<th scope="row"><?php _e('Exclude From Search', 'cpt-plugin') ?></th>
|
1194 |
-
<td>
|
1195 |
-
<SELECT name="cpt_custom_post_type[exclude_from_search]" tabindex="6">
|
1196 |
-
<OPTION value="0" <?php If (isset($cpt_exclude_from_search)) { If ($cpt_exclude_from_search == 0) { echo 'selected="selected"'; } }Else{ echo 'selected="selected"'; } ?>>False</OPTION>
|
1197 |
-
<OPTION value="1" <?php If (isset($cpt_exclude_from_search)) { If ($cpt_exclude_from_search == 1) { echo 'selected="selected"'; } } ?>>True</OPTION>
|
1198 |
-
</SELECT> <a href="#" title="Whether the post type will be searchable" style="cursor: help;">?</a> (default: False)
|
1199 |
-
</td>
|
1200 |
-
</tr>
|
1201 |
-
|
1202 |
-
<tr valign="top">
|
1203 |
-
<th scope="row"><?php _e('Capability Type', 'cpt-plugin') ?></th>
|
1204 |
-
<td><input type="text" name="cpt_custom_post_type[capability_type]" tabindex="6" value="post" value="<?php if ( isset( $cpt_capability ) ) { echo esc_attr( $cpt_capability ); } ?>" /> <a href="#" title="The post type to use for checking read, edit, and delete capabilities" style="cursor: help;">?</a></td>
|
1205 |
-
</tr>
|
1206 |
-
|
1207 |
-
<tr valign="top">
|
1208 |
-
<th scope="row"><?php _e('Hierarchical', 'cpt-plugin') ?></th>
|
1209 |
-
<td>
|
1210 |
-
<SELECT name="cpt_custom_post_type[hierarchical]" tabindex="7">
|
1211 |
-
<OPTION value="0" <?php If (isset($cpt_hierarchical)) { If ($cpt_hierarchical == 0) { echo 'selected="selected"'; } }Else{ echo 'selected="selected"'; } ?>>False</OPTION>
|
1212 |
-
<OPTION value="1" <?php If (isset($cpt_hierarchical)) { If ($cpt_hierarchical == 1) { echo 'selected="selected"'; } } ?>>True</OPTION>
|
1213 |
-
</SELECT> <a href="#" title="Whether the post type is hierarchical" style="cursor: help;">?</a> (default: False)
|
1214 |
-
</td>
|
1215 |
-
</tr>
|
1216 |
-
|
1217 |
-
<tr valign="top">
|
1218 |
-
<th scope="row"><?php _e('Rewrite', 'cpt-plugin') ?></th>
|
1219 |
-
<td>
|
1220 |
-
<SELECT name="cpt_custom_post_type[rewrite]" tabindex="8">
|
1221 |
-
<OPTION value="0" <?php If (isset($cpt_rewrite)) { If ($cpt_rewrite == 0 && $cpt_rewrite != '') { echo 'selected="selected"'; } } ?>>False</OPTION>
|
1222 |
-
<OPTION value="1" <?php If (isset($cpt_rewrite)) { If ($cpt_rewrite == 1 || is_null($cpt_rewrite)) { echo 'selected="selected"'; } }Else{ echo 'selected="selected"'; } ?>>True</OPTION>
|
1223 |
-
</SELECT> <a href="#" title="" style="cursor: help;">?</a> (default: True)
|
1224 |
-
</td>
|
1225 |
-
</tr>
|
1226 |
-
|
1227 |
-
<tr valign="top">
|
1228 |
-
<th scope="row"><?php _e('Custom Rewrite Slug', 'cpt-plugin') ?></th>
|
1229 |
-
<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); } ?>" /> <a href="#" title="Custom Post Type Rewrite Slug" style="cursor: help;">?</a> (default: post type name)</td>
|
1230 |
-
</tr>
|
1231 |
-
|
1232 |
-
<tr valign="top">
|
1233 |
-
<th scope="row"><?php _e('Query Var', 'cpt-plugin') ?></th>
|
1234 |
-
<td>
|
1235 |
-
<SELECT name="cpt_custom_post_type[query_var]" tabindex="10">
|
1236 |
-
<OPTION value="0" <?php If (isset($cpt_query_var)) { If ($cpt_query_var == 0 && $cpt_query_var != '') { echo 'selected="selected"'; } } ?>>False</OPTION>
|
1237 |
-
<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"'; } ?>>True</OPTION>
|
1238 |
-
</SELECT> <a href="#" title="" style="cursor: help;">?</a> (default: True)
|
1239 |
-
</td>
|
1240 |
-
</tr>
|
1241 |
-
|
1242 |
-
<tr valign="top">
|
1243 |
-
<th scope="row"><?php _e('Menu Position', 'cpt-plugin') ?></th>
|
1244 |
-
<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); } ?>" /> <a href="#" title="The menu position of the custom post type" style="cursor: help;">?</a></td>
|
1245 |
-
</tr>
|
1246 |
-
|
1247 |
-
<tr valign="top">
|
1248 |
-
<th scope="row"><?php _e('Show in Menu', 'cpt-plugin') ?></th>
|
1249 |
-
<td>
|
1250 |
-
<SELECT name="cpt_custom_post_type[show_in_menu]" tabindex="10">
|
1251 |
-
<OPTION value="0" <?php If (isset($cpt_show_in_menu)) { If ($cpt_show_in_menu == 0 && $cpt_show_in_menu != '') { echo 'selected="selected"'; } } ?>>False</OPTION>
|
1252 |
-
<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"'; } ?>>True</OPTION>
|
1253 |
-
</SELECT> <a href="#" title="" style="cursor: help;">?</a> Top level page (e.g. 'plugins.php')
|
1254 |
-
<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); } ?>" /> <a href="#" title="Whether to show the post type in the admin menu and where to show that menu. Note that show_ui must be true" style="cursor: help;">?</a></td>
|
1255 |
-
</tr>
|
1256 |
-
|
1257 |
-
<tr valign="top">
|
1258 |
-
<th scope="row"><?php _e('Supports', 'cpt-plugin') ?></th>
|
1259 |
-
<td>
|
1260 |
-
<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"'; } ?> /> Title <a href="#" title="Adds the title meta box when creating content for this custom post type" style="cursor: help;">?</a> <br/ >
|
1261 |
-
<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"'; } ?> /> Editor <a href="#" title="Adds the content editor meta box when creating content for this custom post type" style="cursor: help;">?</a> <br/ >
|
1262 |
-
<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"'; } ?> /> Excerpt <a href="#" title="Adds the excerpt meta box when creating content for this custom post type" style="cursor: help;">?</a> <br/ >
|
1263 |
-
<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"'; } ?> /> Trackbacks <a href="#" title="Adds the trackbacks meta box when creating content for this custom post type" style="cursor: help;">?</a> <br/ >
|
1264 |
-
<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"'; } ?> /> Custom Fields <a href="#" title="Adds the custom fields meta box when creating content for this custom post type" style="cursor: help;">?</a> <br/ >
|
1265 |
-
<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"'; } ?> /> Comments <a href="#" title="Adds the comments meta box when creating content for this custom post type" style="cursor: help;">?</a> <br/ >
|
1266 |
-
<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"'; } ?> /> Revisions <a href="#" title="Adds the revisions meta box when creating content for this custom post type" style="cursor: help;">?</a> <br/ >
|
1267 |
-
<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"'; } ?> /> Featured Image <a href="#" title="Adds the featured image meta box when creating content for this custom post type" style="cursor: help;">?</a> <br/ >
|
1268 |
-
<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"'; } ?> /> Author <a href="#" title="Adds the author meta box when creating content for this custom post type" style="cursor: help;">?</a> <br/ >
|
1269 |
-
<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"'; } ?> /> Page Attributes <a href="#" title="Adds the page attribute meta box when creating content for this custom post type" style="cursor: help;">?</a> <br/ >
|
1270 |
-
</td>
|
1271 |
-
</tr>
|
1272 |
-
|
1273 |
-
<tr valign="top">
|
1274 |
-
<th scope="row"><?php _e('Built-in Taxonomies', 'cpt-plugin') ?></th>
|
1275 |
-
<td>
|
1276 |
-
<?php
|
1277 |
-
//load built-in WP Taxonomies
|
1278 |
-
$args=array( 'public' => true );
|
1279 |
-
$output = 'objects';
|
1280 |
-
$add_taxes = get_taxonomies($args,$output);
|
1281 |
-
foreach ($add_taxes as $add_tax ) {
|
1282 |
-
if ( $add_tax->name != 'nav_menu' && $add_tax->name != 'post_format') {
|
1283 |
-
?>
|
1284 |
-
<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"'; } } ?> /> <?php echo $add_tax->label; ?><br />
|
1285 |
-
<?php
|
1286 |
-
}
|
1287 |
-
}
|
1288 |
-
?>
|
1289 |
-
</td>
|
1290 |
-
</tr>
|
1291 |
-
|
1292 |
-
</table>
|
1293 |
-
</div>
|
1294 |
-
|
1295 |
-
<p class="submit">
|
1296 |
-
<input type="submit" class="button-primary" tabindex="21" name="cpt_submit" value="<?php _e($cpt_submit_name, 'cpt-plugin') ?>" />
|
1297 |
-
</p>
|
1298 |
-
|
1299 |
-
</form>
|
1300 |
-
</td>
|
1301 |
-
<td width="50%" valign="top">
|
1302 |
-
<?php
|
1303 |
-
//debug area
|
1304 |
-
$cpt_options = get_option('cpt_custom_tax_types');
|
1305 |
?>
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
<table class="form-table">
|
1314 |
-
<tr valign="top">
|
1315 |
-
<th scope="row"><?php _e('Taxonomy Name', 'cpt-plugin') ?> <span style="color:red;">*</span></th>
|
1316 |
-
<td><input type="text" name="cpt_custom_tax[name]" tabindex="21" value="<?php If (isset($cpt_tax_name)) { echo esc_attr($cpt_tax_name); } ?>" /> <a href="#" title="The taxonomy name. Used to retrieve custom taxonomy content. Should be short and sweet" style="cursor: help;">?</a> (e.g. actors)</td>
|
1317 |
-
</tr>
|
1318 |
-
|
1319 |
-
<tr valign="top">
|
1320 |
-
<th scope="row"><?php _e('Label', 'cpt-plugin') ?></th>
|
1321 |
-
<td><input type="text" name="cpt_custom_tax[label]" tabindex="22" value="<?php If (isset($cpt_tax_label)) { echo esc_attr($cpt_tax_label); } ?>" /> <a href="#" title="Taxonomy label. Used in the admin menu for displaying custom taxonomy." style="cursor: help;">?</a> (e.g. Actors)</td>
|
1322 |
-
</tr>
|
1323 |
-
|
1324 |
-
<tr valign="top">
|
1325 |
-
<th scope="row"><?php _e('Singular Label', 'cpt-plugin') ?></th>
|
1326 |
-
<td><input type="text" name="cpt_custom_tax[singular_label]" tabindex="23" value="<?php If (isset($cpt_singular_label)) { echo esc_attr($cpt_singular_label); } ?>" /> <a href="#" title="Taxonomy Singular label. Used in WordPress when a singular label is needed." style="cursor: help;">?</a> (e.g. Actor)</td>
|
1327 |
-
</tr>
|
1328 |
-
|
1329 |
-
<tr valign="top">
|
1330 |
-
<th scope="row"><?php _e('Attach to Post Type', 'cpt-plugin') ?> <span style="color:red;">*</span></th>
|
1331 |
-
<td>
|
1332 |
-
<?php if ( isset( $cpt_tax_object_type ) ) { ?>
|
1333 |
-
<strong>This is the old method. Delete the post type from the textbox and check which post type to attach this taxonomy to</strong>
|
1334 |
-
<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); } ?>" /> <a href="#" title="What object to attach the custom taxonomy to. Can be post, page, or link by default. Can also be any custom post type name." style="cursor: help;">?</a> (e.g. movies)
|
1335 |
-
<?php } ?>
|
1336 |
-
<?php
|
1337 |
-
$args=array(
|
1338 |
-
'public' => true
|
1339 |
-
);
|
1340 |
-
$output = 'objects'; // or objects
|
1341 |
-
$post_types=get_post_types($args,$output);
|
1342 |
-
foreach ($post_types as $post_type ) {
|
1343 |
-
if ( $post_type->name != 'attachment' ) {
|
1344 |
?>
|
1345 |
-
|
1346 |
-
|
1347 |
-
}
|
1348 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1349 |
?>
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
1437 |
-
|
1438 |
-
|
1439 |
-
|
1440 |
-
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
1444 |
-
|
1445 |
-
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
-
|
1475 |
-
|
1476 |
-
|
1477 |
-
|
1478 |
-
|
1479 |
-
|
1480 |
-
|
1481 |
-
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
</
|
1486 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1487 |
<?php
|
1488 |
//load footer
|
1489 |
cpt_footer();
|
1490 |
-
|
1491 |
}
|
1492 |
|
1493 |
function cpt_footer() {
|
1494 |
?>
|
1495 |
-
|
1496 |
-
<p class="cp_about"><a target="_blank" href="http://webdevstudios.com/support/forum/custom-post-type-ui/"
|
1497 |
<?php
|
1498 |
}
|
1499 |
|
1500 |
-
function cpt_check_return($return) {
|
1501 |
global $CPT_URL;
|
1502 |
|
1503 |
-
|
1504 |
return ( isset( $_GET['return'] ) ) ? admin_url( 'admin.php?page=cpt_sub_manage_cpt&return=cpt' ) : admin_url( 'admin.php?page=cpt_sub_manage_cpt' );
|
1505 |
-
}
|
1506 |
return ( isset( $_GET['return'] ) ) ? admin_url( 'admin.php?page=cpt_sub_manage_taxonomies&return=tax' ) : admin_url( 'admin.php?page=cpt_sub_manage_taxonomies' );
|
1507 |
-
}
|
1508 |
return admin_url( 'admin.php?page=cpt_sub_add_new' );
|
1509 |
-
}
|
1510 |
return admin_url( 'admin.php?page=cpt_sub_add_new' );
|
1511 |
}
|
1512 |
}
|
1513 |
|
1514 |
function get_disp_boolean($booText) {
|
1515 |
-
|
1516 |
return false;
|
1517 |
-
}Else{
|
1518 |
-
return true;
|
1519 |
}
|
|
|
|
|
1520 |
}
|
1521 |
|
1522 |
function disp_boolean($booText) {
|
1523 |
-
|
1524 |
return 'false';
|
1525 |
-
}Else{
|
1526 |
-
return 'true';
|
1527 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1528 |
}
|
1529 |
-
?>
|
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' );
|
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/
|
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() {
|
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;
|
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
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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
|
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 |
|
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();
|
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';
|
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='';
|
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 |
|
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
|
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 |
|
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 |
}
|
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') ?> ·
|
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') ?> ·
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|