Custom Post Type UI - Version 1.1.0

Version Description

  • Simplified UI with regards to clicking amount.
  • Auto selecting of first available post type or taxonomy in Edit tab.
  • Switch to post type or taxonomy upon selection within Edit tab.
  • Return of a list of CPTUI-registered post types and taxonomies.
  • Post type slug update capability.
  • Added function reference 3rd party link to support area.
  • New hooks in edit screen for custom content display on screen.
  • String updates.
  • UI field option for custom "Supports" parameters from other plugins. Example: Yet Another Related Posts Plugin.
  • Updated help/support section with another reference tool.
  • Trim extra spaces potentially left behind in text inputs.
  • Rearranged menu listing slightly to remove duplicate naming.
  • GitHub repo has GitHub Updater (https://github.com/afragen/github-updater) compatible copy of CPTUI version that is available on WordPress.org
Download this release

Release Info

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

Code changes from version 1.0.8 to 1.1.0

README.md DELETED
@@ -1,4 +0,0 @@
1
- custom-post-type-ui
2
- ===================
3
-
4
- Admin UI for creating custom post types and custom taxonomies in WordPress
 
 
 
 
composer.json DELETED
@@ -1,20 +0,0 @@
1
- {
2
- "name": "WebDevStudios/wp-custom-post-type-ui",
3
- "description": "The Custom Post Type UI Plugin for Wordpress found at https://wordpress.org/plugins/custom-post-type-ui/ ",
4
- "homepage": "https://github.com/WebDevStudios/custom-post-type-ui",
5
- "license": "MIT",
6
- "authors": [
7
- {
8
- "name": "WebDevStudios",
9
- "email": "hello@WebDevStudios",
10
- "homepage": "https://github.com/WebDevStudios/custom-post-type-ui"
11
- }
12
- ],
13
- "minimum-stability": "dev",
14
- "require": {
15
- "php": ">=5.3.0"
16
- },
17
- "autoload": {
18
- "psr-0": { "CPT": "src/" }
19
- }
20
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
css/cptui.css CHANGED
@@ -9,7 +9,7 @@
9
  .cptui-help:hover { font-weight: bold; }
10
  .required { color: rgb(255,0,0); }
11
  .cptui-table #excerpt { height: 16px; margin-right: 4px; width: auto; }
12
- .cptui-table td { vertical-align: top; width: 50%; }
13
  #cptui_select_post_type, #cptui_select_taxonomy { margin-top: 15px; }
14
  .cptui_post_import, .cptui_tax_import {
15
  height: 200px;
@@ -22,60 +22,85 @@
22
  resize: vertical;
23
  width: 100%;
24
  }
25
- #cptui_accordion { height: 500px; }
26
- #cptui_accordion h3:hover, .cptui-table .question:hover { cursor: pointer; }
27
  .question { font-size: 18px; font-weight: bold; }
28
  .answer { margin: 10px 0 0 20px; }
29
- #support li {
30
- position: relative;
31
- }
32
- #cptui_accordion h3:after, #support .question:before {
33
  content: "\f139";
34
  display: inline-block;
35
  font: normal 25px/1 'dashicons';
36
  -webkit-font-smoothing: antialiased;
37
  }
38
- #cptui_accordion h3.ui-state-active:after, #support .question.active:before {
39
- content: "\f140";
40
- }
41
  #support .question:before {
42
  margin-left: -25px;
43
  position: absolute;
44
  }
45
- #cptui_accordion h3:after {
46
- position: absolute;
47
- }
48
  #support ol li { list-style: none; }
49
-
50
- .ui-accordion-content {
51
- overflow: auto;
52
- margin: 0 auto;
53
-
54
- background:
55
- /* Shadow covers */
56
- linear-gradient(#F1F1F1 30%, rgba(255,255,255,0)),
57
- linear-gradient(rgba(255,255,255,0), #F1F1F1 70%) 0 100%,
58
-
59
- /* Shadows */
60
- radial-gradient(50% 0, farthest-side, rgba(0,0,0,.3), rgba(0,0,0,0)),
61
- radial-gradient(50% 100%,farthest-side, rgba(0,0,0,.3), rgba(0,0,0,0)) 0 100%;
62
- background:
63
- /* Shadow covers */
64
- linear-gradient(#F1F1F1 30%, rgba(255,255,255,0)),
65
- linear-gradient(rgba(255,255,255,0), #F1F1F1 70%) 0 100%,
66
-
67
- /* Shadows */
68
- radial-gradient(farthest-side at 50% 0, rgba(0,0,0,.3), rgba(0,0,0,0)),
69
- radial-gradient(farthest-side at 50% 100%, rgba(0,0,0,.3), rgba(0,0,0,0)) 0 100%;
70
- background-repeat: no-repeat;
71
- background-size: 100% 40px, 100% 40px, 100% 14px, 100% 14px;
72
-
73
- /* Opera doesn't support this in the shorthand */
74
- background-attachment: local, local, scroll, scroll;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  }
76
- .one-third {
77
- width: 33%;
 
 
 
78
  }
79
- .valign {
80
- vertical-align: top;
 
 
 
81
  }
9
  .cptui-help:hover { font-weight: bold; }
10
  .required { color: rgb(255,0,0); }
11
  .cptui-table #excerpt { height: 16px; margin-right: 4px; width: auto; }
12
+ .cptui-table td.outter { vertical-align: top; width: 50%; }
13
  #cptui_select_post_type, #cptui_select_taxonomy { margin-top: 15px; }
14
  .cptui_post_import, .cptui_tax_import {
15
  height: 200px;
22
  resize: vertical;
23
  width: 100%;
24
  }
25
+ .cptui-table .question:hover { cursor: pointer; }
 
26
  .question { font-size: 18px; font-weight: bold; }
27
  .answer { margin: 10px 0 0 20px; }
28
+ #support li { position: relative; }
29
+ #support .question:before {
 
 
30
  content: "\f139";
31
  display: inline-block;
32
  font: normal 25px/1 'dashicons';
33
  -webkit-font-smoothing: antialiased;
34
  }
35
+ #support .question.active:before { content: "\f140"; }
 
 
36
  #support .question:before {
37
  margin-left: -25px;
38
  position: absolute;
39
  }
 
 
 
40
  #support ol li { list-style: none; }
41
+ .one-third { width: 33%; }
42
+ .valign { vertical-align: top; }
43
+ .typetax-rename {
44
+ color: rgb(255,0,0);
45
+ display: block;
46
+ }
47
+ .typetax-rename.cptui-hidden { display: none; }
48
+ .about-wrap .cptui-feature {
49
+ overflow: visible !important;
50
+ *zoom:1;
51
+ }
52
+ .about-wrap h3 + .cptui-feature { margin-top: 0; }
53
+ .about-wrap .cptui-feature:before,
54
+ .about-wrap .cptui-feature:after {
55
+ content: " ";
56
+ display: table;
57
+ }
58
+ .about-wrap .cptui-feature:after { clear: both; }
59
+ .about-wrap .feature-rest div {
60
+ width: 50% !important;
61
+ padding-right: 100px;
62
+ -moz-box-sizing: border-box;
63
+ box-sizing: border-box;
64
+ margin: 0 !important;
65
+ }
66
+ .rtl .about-wrap .feature-rest div { padding-left: 100px; }
67
+ .about-wrap .feature-rest div.last-feature {
68
+ padding-left: 100px;
69
+ padding-right: 0;
70
+ }
71
+ .rtl .about-wrap .feature-rest div.last-feature {
72
+ padding-right: 100px;
73
+ padding-left: 0;
74
+ }
75
+ .about-wrap div.icon {
76
+ width: 0 !important;
77
+ padding: 0;
78
+ margin: 0;
79
+ }
80
+ .about-wrap .feature-rest div.icon:before {
81
+ font-weight: normal;
82
+ width: 100%;
83
+ font-size: 170px;
84
+ line-height: 125px;
85
+ color: #9c5d90;
86
+ display: inline-block;
87
+ position: relative;
88
+ text-align: center;
89
+ speak: none;
90
+ margin: 0 0 0 -100px;
91
+ content: "\e01d";
92
+ -webkit-font-smoothing: antialiased;
93
+ -moz-osx-font-smoothing: grayscale;
94
  }
95
+ .rtl .about-wrap .feature-rest div.icon:before { margin: 0 -100px 0 0; }
96
+ .about-integrations {
97
+ background: #fff;
98
+ margin: 20px 0;
99
+ padding: 1px 20px 10px;
100
  }
101
+ .changelog h4 { line-height: 1.4; }
102
+ .cptui-about-text { margin-bottom: 1em !important; }
103
+ .cptui-table th p {
104
+ font-weight: 400;
105
+ font-size: 12px;
106
  }
custom-post-type-ui.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Custom Post Type UI
4
  Plugin URI: https://github.com/WebDevStudios/custom-post-type-ui/
5
  Description: Admin panel for creating custom post types and custom taxonomies in WordPress
6
  Author: WebDevStudios
7
- Version: 1.0.8
8
  Author URI: http://webdevstudios.com/
9
  Text Domain: cpt-plugin
10
  Domain Path: /languages
@@ -16,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) {
16
  exit;
17
  }
18
 
19
- define( 'CPT_VERSION', '1.0.8' );
20
  define( 'CPTUI_WP_VERSION', get_bloginfo( 'version' ) );
21
 
22
  /**
@@ -52,10 +52,21 @@ add_action( 'init', 'cptui_load_textdomain' );
52
  /**
53
  * Load our main menu.
54
  *
 
 
55
  * @since 0.1.0
56
  */
57
  function cptui_plugin_menu() {
58
  add_menu_page( __( 'Custom Post Types', 'cpt-plugin' ), __( 'CPT UI', 'cpt-plugin' ), 'manage_options', 'cptui_main_menu', 'cptui_settings' );
 
 
 
 
 
 
 
 
 
59
  }
60
  add_action( 'admin_menu', 'cptui_plugin_menu' );
61
 
@@ -67,6 +78,7 @@ add_action( 'admin_menu', 'cptui_plugin_menu' );
67
  function cptui_create_submenus() {
68
  require_once( plugin_dir_path( __FILE__ ) . 'inc/post-types.php' );
69
  require_once( plugin_dir_path( __FILE__ ) . 'inc/taxonomies.php' );
 
70
  require_once( plugin_dir_path( __FILE__ ) . 'inc/import_export.php' );
71
  require_once( plugin_dir_path( __FILE__ ) . 'inc/support.php' );
72
  }
@@ -131,6 +143,13 @@ function cptui_register_single_post_type( $post_type = array() ) {
131
  $post_type['supports'] = array_merge( $post_type['supports'], $user_supports_params );
132
  }
133
 
 
 
 
 
 
 
 
134
  if ( in_array( 'none', $post_type['supports'] ) ) {
135
  $post_type['supports'] = false;
136
  }
@@ -308,7 +327,7 @@ function cptui_register_single_taxonomy( $taxonomy = array() ) {
308
  * @return string $value HTML markup for the page.
309
  */
310
  function cptui_settings() { ?>
311
- <div class="wrap">
312
  <?php
313
 
314
  /**
@@ -317,33 +336,31 @@ function cptui_settings() { ?>
317
  * @since 1.0.0
318
  */
319
  do_action( 'cptui_main_page_start' ); ?>
320
- <h2><?php _e( 'Custom Post Type UI', 'cpt-plugin' ); ?> <?php echo CPT_VERSION; ?></h2>
321
 
322
- <div class="alignleft">
323
- <p><?php _e( 'Thank you for choosing Custom Post Type UI. We hope that your experience with our plugin provides efficiency and speed in creating post types and taxonomies, to better organize your content, without having to touch code.', 'cpt-plugin' ); ?></p>
324
-
325
- <p><?php echo sprintf( __( 'To get started with creating some post types, please visit %s and for taxonomies, visit %s. If you need some help, check the %s page. If nothing there fits your issue, visit our %s and we will try to get to your question as soon as possible.', 'cpt-plugin' ),
326
- sprintf( '<a href="' . admin_url( 'admin.php?page=cptui_manage_post_types' ) . '">%s</a>', __( 'Add/Edit Post Types', 'cpt-plugin' ) ),
327
- sprintf( '<a href="' . admin_url( 'admin.php?page=cptui_manage_taxonomies' ) . '">%s</a>', __( 'Add/Edit Taxonomies', 'cpt-plugin' ) ),
328
- sprintf( '<a href="' . admin_url( 'admin.php?page=cptui_support' ) . '">%s</a>', __( 'Help/Support', 'cpt-plugin' ) ),
329
- sprintf( '<a href="http://wordpress.org/support/plugin/custom-post-type-ui">%s</a>', __( 'CPT UI Support Forum', 'cpt-plugin' ) )
330
- );
331
- ?>
332
- </p>
333
  </div>
334
 
335
- <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
336
 
337
- /**
338
- * Fires right above the table displaying the promoted books.
339
- *
340
- * @since 1.0.0
341
- */
342
- do_action( 'cptui_main_page_before_books' ); ?>
343
  <table border="0">
344
- <tr>
345
- <td colspan="3"><h2><?php _e( 'Help Support This Plugin!', 'cpt-plugin' ); ?></h2></td>
346
- </tr>
347
  <tr>
348
  <td class="one-third valign">
349
  <h3><?php _e( 'Professional WordPress<br />Third Edition', 'cpt-plugin' ); ?></h3>
@@ -351,7 +368,7 @@ function cptui_settings() { ?>
351
  <img src="<?php echo plugins_url( '/images/professional-wordpress-thirdedition.jpg', __FILE__ ); ?>" width="200">
352
  </a>
353
  <br />
354
- <?php _e( 'The leading book on WordPress design and development! Brand new third edition!', 'cpt-plugin' ); ?>
355
  </td>
356
  <td class="one-third valign">
357
  <h3><?php _e( 'Professional WordPress<br />Plugin Development', 'cpt-plugin' ); ?></h3>
@@ -359,29 +376,20 @@ function cptui_settings() { ?>
359
  <img src="<?php echo plugins_url( '/images/professional-wordpress-plugin-development.png', __FILE__ ); ?>" width="200">
360
  </a>
361
  <br />
362
- <?php _e( 'Highest rated WordPress development book on Amazon!', 'cpt-plugin' ); ?>
363
  </td>
364
  <td class="one-third valign">
365
  <h3><?php _e( 'PayPal Donation', 'cpt-plugin' ); ?></h3>
366
- <p><?php _e( 'Please donate to the development of Custom Post Type UI:', 'cpt-plugin' ); ?></p>
367
  <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
368
  <input type="hidden" name="cmd" value="_s-xclick">
369
  <input type="hidden" name="hosted_button_id" value="YJEDXPHE49Q3U">
370
  <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" name="submit" alt="<?php esc_attr_e( 'PayPal - The safer, easier way to pay online!', 'cpt-plugin' ); ?>">
371
  <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
372
  </form>
 
373
  </td>
374
  </tr>
375
  </table>
376
-
377
- <?php
378
- /**
379
- * Fires right after the table displaying the promoted books.
380
- *
381
- * @since 1.0.0
382
- */
383
- do_action( 'cptui_main_page_after_books' ); ?>
384
-
385
  </div>
386
  <?php
387
  }
@@ -404,18 +412,23 @@ function cptui_footer( $original = '' ) {
404
  }
405
 
406
  return sprintf(
407
- __( '%s version %s by %s - %s %s %s &middot; %s &middot; %s', 'cpt-plugin' ),
408
  sprintf(
409
  '<a target="_blank" href="http://wordpress.org/support/plugin/custom-post-type-ui">%s</a>',
410
  __( 'Custom Post Type UI', 'cpt-plugin' )
411
  ),
412
  CPT_VERSION,
413
- '<a href="http://webdevstudios.com" target="_blank">WebDevStudios</a>',
414
- sprintf(
415
- '<a href="https://github.com/WebDevStudios/custom-post-type-ui/issues" target="_blank">%s</a>',
416
- __( 'Please Report Bugs', 'cpt-plugin' )
417
- ),
418
- __( 'Follow on Twitter:', 'cpt-plugin' ),
 
 
 
 
 
419
  '<a href="http://twitter.com/tw2113" target="_blank">Michael</a>',
420
  '<a href="http://twitter.com/williamsba" target="_blank">Brad</a>',
421
  '<a href="http://twitter.com/webdevstudios" target="_blank">WebDevStudios</a>'
@@ -535,7 +548,6 @@ function cptui_settings_tab_menu( $page = 'post_types' ) {
535
  do_action( 'cptui_settings_tabs_after' );
536
  ?>
537
  </h2>
538
-
539
  <?php
540
  }
541
 
4
  Plugin URI: https://github.com/WebDevStudios/custom-post-type-ui/
5
  Description: Admin panel for creating custom post types and custom taxonomies in WordPress
6
  Author: WebDevStudios
7
+ Version: 1.1.0
8
  Author URI: http://webdevstudios.com/
9
  Text Domain: cpt-plugin
10
  Domain Path: /languages
16
  exit;
17
  }
18
 
19
+ define( 'CPT_VERSION', '1.1.0' );
20
  define( 'CPTUI_WP_VERSION', get_bloginfo( 'version' ) );
21
 
22
  /**
52
  /**
53
  * Load our main menu.
54
  *
55
+ * Submenu items added in version 1.1.0
56
+ *
57
  * @since 0.1.0
58
  */
59
  function cptui_plugin_menu() {
60
  add_menu_page( __( 'Custom Post Types', 'cpt-plugin' ), __( 'CPT UI', 'cpt-plugin' ), 'manage_options', 'cptui_main_menu', 'cptui_settings' );
61
+ add_submenu_page( 'cptui_main_menu', __( 'Add/Edit Post Types', 'cpt-plugin' ), __( 'Add/Edit Post Types', 'cpt-plugin' ), 'manage_options', 'cptui_manage_post_types', 'cptui_manage_post_types' );
62
+ add_submenu_page( 'cptui_main_menu', __( 'Add/Edit Taxonomies', 'cpt-plugin' ), __( 'Add/Edit Taxonomies', 'cpt-plugin' ), 'manage_options', 'cptui_manage_taxonomies', 'cptui_manage_taxonomies' );
63
+ add_submenu_page( 'cptui_main_menu', __( 'Registered Types and Taxes', 'cpt-plugin' ), __( 'Registered Types/Taxes', 'cpt-plugin' ), 'manage_options', 'cptui_listings', 'cptui_listings' );
64
+ add_submenu_page( 'cptui_main_menu', __( 'Import/Export', 'cpt-plugin' ), __( 'Import/Export', 'cpt-plugin' ), 'manage_options', 'cptui_importexport', 'cptui_importexport' );
65
+ add_submenu_page( 'cptui_main_menu', __( 'Help/Support', 'cpt-plugin' ), __( 'Help/Support', 'cpt-plugin' ), 'manage_options', 'cptui_support', 'cptui_support' );
66
+
67
+ # Remove the default one so we can add our customized version.
68
+ remove_submenu_page('cptui_main_menu', 'cptui_main_menu');
69
+ add_submenu_page( 'cptui_main_menu', __( 'About CPT UI', 'cpt-plugin' ), __( 'About CPT UI', 'cpt-plugin' ), 'manage_options', 'cptui_main_menu', 'cptui_settings' );
70
  }
71
  add_action( 'admin_menu', 'cptui_plugin_menu' );
72
 
78
  function cptui_create_submenus() {
79
  require_once( plugin_dir_path( __FILE__ ) . 'inc/post-types.php' );
80
  require_once( plugin_dir_path( __FILE__ ) . 'inc/taxonomies.php' );
81
+ require_once( plugin_dir_path( __FILE__ ) . 'inc/listings.php' );
82
  require_once( plugin_dir_path( __FILE__ ) . 'inc/import_export.php' );
83
  require_once( plugin_dir_path( __FILE__ ) . 'inc/support.php' );
84
  }
143
  $post_type['supports'] = array_merge( $post_type['supports'], $user_supports_params );
144
  }
145
 
146
+ if ( ! empty( $post_type['custom_supports'] ) ) {
147
+ $custom = explode( ',', $post_type['custom_supports'] );
148
+ foreach( $custom as $part ) {
149
+ $post_type['supports'][] = $part;
150
+ }
151
+ }
152
+
153
  if ( in_array( 'none', $post_type['supports'] ) ) {
154
  $post_type['supports'] = false;
155
  }
327
  * @return string $value HTML markup for the page.
328
  */
329
  function cptui_settings() { ?>
330
+ <div class="wrap about-wrap">
331
  <?php
332
 
333
  /**
336
  * @since 1.0.0
337
  */
338
  do_action( 'cptui_main_page_start' ); ?>
339
+ <h1><?php _e( 'Custom Post Type UI', 'cpt-plugin' ); ?> <?php echo CPT_VERSION; ?></h1>
340
 
341
+ <div class="about-text cptui-about-text">
342
+ <?php _e( 'Thank you for choosing Custom Post Type UI. We hope that your experience with our plugin provides efficiency and speed in creating post types and taxonomies, to better organize your content, without having to touch code.', 'cpt-plugin' ); ?>
 
 
 
 
 
 
 
 
 
343
  </div>
344
 
345
+ <div class="changelog about-integrations">
346
+ <div class="cptui-feature feature-section col three-col">
347
+ <div>
348
+ <h4><?php _e( 'Post type migration', 'cpt-plugin' ); ?></h4>
349
+ <p><?php _e( 'In the past, if you changed your post type slug, you would lose immediate access to the posts in the post type and need to recover another way. We have now added support for migrating all posts within the old post type to the new post type you renamed it to.', 'cpt-plugin' ); ?></p>
350
+ </div>
351
+ <div>
352
+ <h4><?php _e( 'UI Refinement', 'cpt-plugin' ); ?></h4>
353
+ <p><?php _e( 'After receiving feedback regarding the 1.0.x changes, we have further simplified the UI to reduce the amount of clicking necessary to manage your post types and taxonomies.', 'cpt-plugin' ); ?></p>
354
+ </div>
355
+ <div class="last-feature">
356
+ <h4><?php _e( 'Registered Post Type and Taxonomy Listings', 'cpt-plugin' ); ?></h4>
357
+ <p><?php _e( 'We are bringing back the listing of all CPTUI-registered post types and taxonomies for easier quick view of what you have going.', 'cpt-plugin' ); ?></p>
358
+ </div>
359
+ </div>
360
+ </div>
361
 
362
+ <h2><?php _e( 'Help Support This Plugin!', 'cpt-plugin' ); ?></h2>
 
 
 
 
 
363
  <table border="0">
 
 
 
364
  <tr>
365
  <td class="one-third valign">
366
  <h3><?php _e( 'Professional WordPress<br />Third Edition', 'cpt-plugin' ); ?></h3>
368
  <img src="<?php echo plugins_url( '/images/professional-wordpress-thirdedition.jpg', __FILE__ ); ?>" width="200">
369
  </a>
370
  <br />
371
+ <p><?php _e( 'The leading book on WordPress design and development! Brand new third edition!', 'cpt-plugin' ); ?></p>
372
  </td>
373
  <td class="one-third valign">
374
  <h3><?php _e( 'Professional WordPress<br />Plugin Development', 'cpt-plugin' ); ?></h3>
376
  <img src="<?php echo plugins_url( '/images/professional-wordpress-plugin-development.png', __FILE__ ); ?>" width="200">
377
  </a>
378
  <br />
379
+ <p><?php _e( 'Highest rated WordPress development book on Amazon!', 'cpt-plugin' ); ?></p>
380
  </td>
381
  <td class="one-third valign">
382
  <h3><?php _e( 'PayPal Donation', 'cpt-plugin' ); ?></h3>
 
383
  <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
384
  <input type="hidden" name="cmd" value="_s-xclick">
385
  <input type="hidden" name="hosted_button_id" value="YJEDXPHE49Q3U">
386
  <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" name="submit" alt="<?php esc_attr_e( 'PayPal - The safer, easier way to pay online!', 'cpt-plugin' ); ?>">
387
  <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
388
  </form>
389
+ <p><?php _e( 'Please donate to the development of Custom Post Type UI:', 'cpt-plugin' ); ?></p>
390
  </td>
391
  </tr>
392
  </table>
 
 
 
 
 
 
 
 
 
393
  </div>
394
  <?php
395
  }
412
  }
413
 
414
  return sprintf(
415
+ __( '%s version %s by %s', 'cpt-plugin' ),
416
  sprintf(
417
  '<a target="_blank" href="http://wordpress.org/support/plugin/custom-post-type-ui">%s</a>',
418
  __( 'Custom Post Type UI', 'cpt-plugin' )
419
  ),
420
  CPT_VERSION,
421
+ '<a href="http://webdevstudios.com" target="_blank">WebDevStudios</a>'
422
+ ).
423
+ ' - '.
424
+ sprintf(
425
+ '<a href="https://github.com/WebDevStudios/custom-post-type-ui/issues" target="_blank">%s</a>',
426
+ __( 'Please Report Bugs', 'cpt-plugin' )
427
+ ).
428
+ ' '.
429
+ __( 'Follow on Twitter:', 'cpt-plugin' ).
430
+ sprintf(
431
+ ' %s &middot; %s &middot; %s',
432
  '<a href="http://twitter.com/tw2113" target="_blank">Michael</a>',
433
  '<a href="http://twitter.com/williamsba" target="_blank">Brad</a>',
434
  '<a href="http://twitter.com/webdevstudios" target="_blank">WebDevStudios</a>'
548
  do_action( 'cptui_settings_tabs_after' );
549
  ?>
550
  </h2>
 
551
  <?php
552
  }
553
 
inc/import_export.php CHANGED
@@ -6,16 +6,6 @@
6
  # Exit if accessed directly
7
  if ( ! defined( 'ABSPATH' ) ) exit;
8
 
9
- /**
10
- * Add our settings page to the menu.
11
- *
12
- * @since 1.0.0
13
- */
14
- function cptui_importexport_admin_menu() {
15
- add_submenu_page( 'cptui_main_menu', __( 'Import/Export', 'cpt-plugin' ), __( 'Import/Export', 'cpt-plugin' ), 'manage_options', 'cptui_importexport', 'cptui_importexport' );
16
- }
17
- add_action( 'admin_menu', 'cptui_importexport_admin_menu' );
18
-
19
  /**
20
  * Create our settings page output.
21
  *
@@ -59,7 +49,7 @@ function cptui_importexport() {
59
  <table class="form-table cptui-table">
60
  <?php if ( !empty( $_GET ) && empty( $_GET['action'] ) ) { ?>
61
  <tr>
62
- <td>
63
  <h3><?php _e( 'Import Post Types', 'cpt-plugin' ); ?></h3>
64
  <form method="post">
65
  <textarea class="cptui_post_import" placeholder="<?php esc_attr_e( 'Paste content here.', 'cpt-plugin' ); ?>" name="cptui_post_import"></textarea>
@@ -68,7 +58,7 @@ function cptui_importexport() {
68
  <p><input class="button button-primary" type="submit" value="<?php esc_attr_e( 'Import', 'cpt-plugin' ); ?>"/></p>
69
  </form>
70
  </td>
71
- <td>
72
  <h3><?php _e( 'Export Post Types', 'cpt-plugin' ); ?></h3>
73
  <?php
74
  $cptui_post_types = get_option( 'cptui_post_types', array() );
@@ -84,7 +74,7 @@ function cptui_importexport() {
84
  </tr>
85
  <?php } elseif ( !empty( $_GET ) && 'taxonomies' == $_GET['action'] ) { ?>
86
  <tr>
87
- <td>
88
  <h3><?php _e( 'Import Taxonomies', 'cpt-plugin' ); ?></h3>
89
  <form method="post">
90
  <textarea class="cptui_tax_import" placeholder="<?php esc_attr_e( 'Paste content here.', 'cpt-plugin' ); ?>" name="cptui_tax_import"></textarea>
@@ -93,7 +83,7 @@ function cptui_importexport() {
93
  <p><input class="button button-primary" type="submit" value="<?php esc_attr_e( 'Import', 'cpt-plugin' ); ?>"/></p>
94
  </form>
95
  </td>
96
- <td>
97
  <h3><?php _e( 'Export Taxonomies', 'cpt-plugin' ); ?></h3>
98
  <?php
99
  $cptui_taxonomies = get_option( 'cptui_taxonomies', array() );
@@ -208,8 +198,7 @@ function cptui_get_single_taxonomy_registery( $taxonomy = array() ) {
208
  if ( !empty( $label ) ) {
209
  echo '"' . $key . '" => "' . $label . '",' . "\n\t\t";
210
  }
211
- } ?>
212
- );
213
 
214
  $args = array(
215
  "labels" => $labels,
@@ -340,10 +329,9 @@ function cptui_get_single_post_type_registery( $post_type = array() ) {
340
  "hierarchical" => <?php echo disp_boolean( $post_type['hierarchical'] ); ?>,
341
  "rewrite" => <?php echo $rewrite; ?>,
342
  "query_var" => <?php echo disp_boolean( $post_type['query_var'] ); ?>,
343
- <?php if ( !empty( $post_type['menu_position'] ) ) { ?>"menu_position" => <?php echo $post_type['menu_position']; ?>,<?php } ?>
344
- <?php if ( !empty( $post_type['menu_icon'] ) ) { ?>"menu_icon" => "<?php echo $post_type['menu_icon']; ?>",<?php } ?>
345
- <?php if ( !empty( $supports ) ) { ?>"supports" => <?php echo $supports; ?>,<?php } ?>
346
- <?php if ( !empty( $taxonomies ) ) { ?>"taxonomies" => <?php echo $taxonomies; ?><?php } ?>
347
  );
348
  register_post_type( "<?php echo $post_type['name']; ?>", $args );
349
  <?php
6
  # Exit if accessed directly
7
  if ( ! defined( 'ABSPATH' ) ) exit;
8
 
 
 
 
 
 
 
 
 
 
 
9
  /**
10
  * Create our settings page output.
11
  *
49
  <table class="form-table cptui-table">
50
  <?php if ( !empty( $_GET ) && empty( $_GET['action'] ) ) { ?>
51
  <tr>
52
+ <td class="outter">
53
  <h3><?php _e( 'Import Post Types', 'cpt-plugin' ); ?></h3>
54
  <form method="post">
55
  <textarea class="cptui_post_import" placeholder="<?php esc_attr_e( 'Paste content here.', 'cpt-plugin' ); ?>" name="cptui_post_import"></textarea>
58
  <p><input class="button button-primary" type="submit" value="<?php esc_attr_e( 'Import', 'cpt-plugin' ); ?>"/></p>
59
  </form>
60
  </td>
61
+ <td class="outter">
62
  <h3><?php _e( 'Export Post Types', 'cpt-plugin' ); ?></h3>
63
  <?php
64
  $cptui_post_types = get_option( 'cptui_post_types', array() );
74
  </tr>
75
  <?php } elseif ( !empty( $_GET ) && 'taxonomies' == $_GET['action'] ) { ?>
76
  <tr>
77
+ <td class="outter">
78
  <h3><?php _e( 'Import Taxonomies', 'cpt-plugin' ); ?></h3>
79
  <form method="post">
80
  <textarea class="cptui_tax_import" placeholder="<?php esc_attr_e( 'Paste content here.', 'cpt-plugin' ); ?>" name="cptui_tax_import"></textarea>
83
  <p><input class="button button-primary" type="submit" value="<?php esc_attr_e( 'Import', 'cpt-plugin' ); ?>"/></p>
84
  </form>
85
  </td>
86
+ <td class="outter">
87
  <h3><?php _e( 'Export Taxonomies', 'cpt-plugin' ); ?></h3>
88
  <?php
89
  $cptui_taxonomies = get_option( 'cptui_taxonomies', array() );
198
  if ( !empty( $label ) ) {
199
  echo '"' . $key . '" => "' . $label . '",' . "\n\t\t";
200
  }
201
+ } ?>);
 
202
 
203
  $args = array(
204
  "labels" => $labels,
329
  "hierarchical" => <?php echo disp_boolean( $post_type['hierarchical'] ); ?>,
330
  "rewrite" => <?php echo $rewrite; ?>,
331
  "query_var" => <?php echo disp_boolean( $post_type['query_var'] ); ?>,
332
+ <?php if ( !empty( $post_type['menu_position'] ) ) { ?>"menu_position" => <?php echo $post_type['menu_position']; ?>,<?php } ?><?php if ( !empty( $post_type['menu_icon'] ) ) { ?>"menu_icon" => "<?php echo $post_type['menu_icon']; ?>",<?php } ?>
333
+ <?php if ( !empty( $supports ) ) { echo "\n\t\t" ?>"supports" => <?php echo $supports; ?>,<?php } ?>
334
+ <?php if ( !empty( $taxonomies ) ) { echo "\n\t\t" ?>"taxonomies" => <?php echo $taxonomies; ?><?php } echo "\n"?>
 
335
  );
336
  register_post_type( "<?php echo $post_type['name']; ?>", $args );
337
  <?php
inc/listings.php ADDED
@@ -0,0 +1,234 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ # Exit if accessed directly
4
+ if ( ! defined( 'ABSPATH' ) ) exit;
5
+
6
+ function cptui_listings() {
7
+ ?>
8
+ <div class="wrap">
9
+
10
+ <h1><?php _e( 'Post Types and Taxonomies registered by Custom Post Type UI.', 'cpt-plugin' ); ?></h1>
11
+ <?php
12
+ $post_types = get_option( 'cptui_post_types' );
13
+
14
+ if ( !empty( $post_types ) ) {
15
+
16
+ echo '<h2>' . __( 'Post Types', 'cpt-plugin' ) . '</h2>';
17
+ ?>
18
+ <p><?php printf( __( 'Total count: %d', 'cpt-plugin' ), count( $post_types ) ); ?></p>
19
+
20
+ <?php
21
+
22
+ /**
23
+ * Fires before the listing of registered post type data.
24
+ *
25
+ * @since 1.1.0
26
+ */
27
+ do_action( 'cptui_before_post_type_listing' );
28
+ ?>
29
+ <table class="wp-list-table widefat">
30
+ <tr>
31
+ <th><?php _e( 'Post Type', 'cpt-plugin' ); ?></th>
32
+ <th><?php _e( 'Settings', 'cpt-plugin' ); ?></th>
33
+ <th><?php _e( 'Supports', 'cpt-plugin' ); ?></th>
34
+ <th><?php _e( 'Taxonomies', 'cpt-plugin' ); ?></th>
35
+ <th><?php _e( 'Labels', 'cpt-plugin' ); ?></th>
36
+ </tr>
37
+ <?php
38
+ $counter = 1;
39
+ foreach ( $post_types as $post_type => $post_type_settings ) {
40
+
41
+ $rowclass = ( $counter % 2 == 0 ) ? '' : 'alternate';
42
+
43
+ $strings = array();
44
+ $supports = array();
45
+ $taxonomies = array();
46
+ foreach( $post_type_settings as $settings_key => $settings_value ) {
47
+ if ( 'labels' == $settings_key ) {
48
+ continue;
49
+ }
50
+
51
+ if ( is_string( $settings_value ) ) {
52
+ $strings[ $settings_key ] = $settings_value;
53
+ } else {
54
+ if ( 'supports' === $settings_key ) {
55
+ $supports[ $settings_key ] = $settings_value;
56
+ }
57
+
58
+ if ( 'taxonomies' === $settings_key ) {
59
+ $taxonomies[ $settings_key ] = $settings_value;
60
+
61
+ # In case they are not associated from the post type settings
62
+ if ( empty( $taxonomies['taxonomies'] ) ) {
63
+ $taxonomies['taxonomies'] = get_object_taxonomies( $post_type );
64
+ }
65
+ }
66
+ }
67
+ $archive = get_post_type_archive_link( $post_type );
68
+ }
69
+ ?>
70
+ <tr class="<?php echo $rowclass; ?>">
71
+ <td><a href="<?php echo admin_url( 'admin.php?page=cptui_manage_post_types&action=edit&cptui_post_type=' . $post_type ); ?>"><?php echo $post_type; ?></a><br/><hr/>
72
+ <a href="<?php echo admin_url( 'admin.php?page=cptui_manage_post_types&action=edit&cptui_post_type=' . $post_type ); ?>"><?php _e( 'Edit', 'cpt-plugin' ); ?></a>
73
+ <?php if ( $archive ) { ?>
74
+ |
75
+ <a href="<?php echo get_post_type_archive_link( $post_type ); ?>"><?php _e( 'View frontend archive', 'cpt-plugin' ); ?></a>
76
+ <?php } ?>
77
+ </td>
78
+ <td>
79
+ <?php foreach ( $strings as $key => $value ) {
80
+ printf( '<strong>%s:</strong> ', $key );
81
+ if ( in_array( $value, array( '1', '0' ) ) ) {
82
+ echo disp_boolean( $value );
83
+ } else {
84
+ echo $value;
85
+ }
86
+ echo '<br/>';
87
+ } ?>
88
+ </td>
89
+ <td>
90
+ <?php foreach ( $supports['supports'] as $support ) {
91
+ echo $support . '<br/>';
92
+ } ?>
93
+ </td>
94
+ <td>
95
+ <?php
96
+ foreach ( $taxonomies['taxonomies'] as $taxonomy ) {
97
+ echo $taxonomy . '<br/>';
98
+ } ?>
99
+ </td>
100
+ <td>
101
+ <?php
102
+ $maybe_empty = array_filter( $post_type_settings['labels'] );
103
+ if ( !empty( $maybe_empty ) ) {
104
+ foreach ( $post_type_settings['labels'] as $key => $value ) {
105
+ echo $key . ': ' . $value . '<br/>';
106
+ }
107
+ } else {
108
+ _e( 'No custom labels to display', 'cpt-plugin' );
109
+ }
110
+ ?>
111
+ </td>
112
+ </tr>
113
+
114
+ <?php
115
+ $counter++;
116
+ }
117
+ ?>
118
+ <tr>
119
+ <th><?php _e( 'Post Type', 'cpt-plugin' ); ?></th>
120
+ <th><?php _e( 'Settings', 'cpt-plugin' ); ?></th>
121
+ <th><?php _e( 'Supports', 'cpt-plugin' ); ?></th>
122
+ <th><?php _e( 'Taxonomies', 'cpt-plugin' ); ?></th>
123
+ <th><?php _e( 'Labels', 'cpt-plugin' ); ?></th>
124
+ </tr>
125
+ </table>
126
+ <?php
127
+ }
128
+
129
+ $taxonomies = get_option( 'cptui_taxonomies' );
130
+ if ( !empty( $taxonomies ) ) {
131
+
132
+ echo '<h2>' . __( 'Taxonomies', 'cpt-plugin' ) . '</h2>';
133
+ ?>
134
+ <p><?php printf( __( 'Total count: %d', 'cpt-plugin' ), count( $taxonomies ) ); ?></p>
135
+
136
+ <?php
137
+
138
+ /**
139
+ * Fires before the listing of registered taxonomy data.
140
+ *
141
+ * @since 1.1.0
142
+ */
143
+ do_action( 'cptui_before_taxonomy_listing' );
144
+ ?>
145
+ <table class="wp-list-table widefat">
146
+ <tr>
147
+ <th><?php _e( 'Taxonomy', 'cpt-plugin' ); ?></th>
148
+ <th><?php _e( 'Settings', 'cpt-plugin' ); ?></th>
149
+ <th><?php _e( 'Post Types', 'cpt-plugin' ); ?></th>
150
+ <th><?php _e( 'Labels', 'cpt-plugin' ); ?></th>
151
+ </tr>
152
+ <?php
153
+ $counter = 1;
154
+ foreach ( $taxonomies as $taxonomy => $taxonomy_settings ) {
155
+
156
+ $rowclass = ( $counter % 2 == 0 ) ? '' : 'alternate';
157
+
158
+ $strings = array();
159
+ $object_types = array();
160
+ foreach( $taxonomy_settings as $settings_key => $settings_value ) {
161
+ if ( 'labels' == $settings_key ) {
162
+ continue;
163
+ }
164
+
165
+ if ( is_string( $settings_value ) ) {
166
+ $strings[ $settings_key ] = $settings_value;
167
+ } else {
168
+ if ( 'object_types' === $settings_key ) {
169
+ $object_types[ $settings_key ] = $settings_value;
170
+
171
+ # In case they are not associated from the post type settings
172
+ if ( empty( $object_types['taxonomies'] ) ) {
173
+ $types = get_taxonomy( $taxonomy );
174
+ $object_types['types'] = $types->object_type;
175
+ }
176
+ }
177
+ }
178
+ }
179
+ ?>
180
+ <tr class="<?php echo $rowclass; ?>">
181
+ <td><a href="<?php echo admin_url( 'admin.php?page=cptui_manage_taxonomies&action=edit&cptui_taxonomy=' . $taxonomy ); ?>"><?php echo $taxonomy; ?></a><br/><hr/>
182
+ <a href="<?php echo admin_url( 'admin.php?page=cptui_manage_taxonomies&action=edit&cptui_taxonomy=' . $taxonomy ); ?>"><?php _e( 'Edit', 'cpt-plugin' ); ?></a>
183
+ </td>
184
+ <td>
185
+ <?php foreach ( $strings as $key => $value ) {
186
+ printf( '<strong>%s:</strong> ', $key );
187
+ if ( in_array( $value, array( '1', '0' ) ) ) {
188
+ echo disp_boolean( $value );
189
+ } else {
190
+ echo $value;
191
+ }
192
+ echo '<br/>';
193
+ } ?>
194
+ </td>
195
+ <td>
196
+ <?php
197
+ if ( !empty( $object_types['types'] ) ) {
198
+ foreach ( $object_types['types'] as $type ) {
199
+ echo $type . '<br/>';
200
+ }
201
+ } ?>
202
+ </td>
203
+ <td>
204
+ <?php
205
+ $maybe_empty = array_filter( $taxonomy_settings['labels'] );
206
+ if ( !empty( $maybe_empty ) ) {
207
+ foreach ( $taxonomy_settings['labels'] as $key => $value ) {
208
+ echo $key . ': ' . $value . '<br/>';
209
+ }
210
+ } else {
211
+ _e( 'No custom labels to display', 'cpt-plugin' );
212
+ }
213
+ ?>
214
+ </td>
215
+ </tr>
216
+
217
+ <?php
218
+ $counter++;
219
+ }
220
+ ?>
221
+ <tr>
222
+ <th><?php _e( 'Taxonomy', 'cpt-plugin' ); ?></th>
223
+ <th><?php _e( 'Settings', 'cpt-plugin' ); ?></th>
224
+ <th><?php _e( 'Post Types', 'cpt-plugin' ); ?></th>
225
+ <th><?php _e( 'Labels', 'cpt-plugin' ); ?></th>
226
+ </tr>
227
+ </table>
228
+ <?php
229
+ }
230
+ ?>
231
+
232
+ </div>
233
+ <?php
234
+ }
inc/post-types.php CHANGED
@@ -19,21 +19,22 @@ function cptui_post_type_enqueue_scripts() {
19
  return;
20
  }
21
 
 
 
 
 
 
22
  wp_enqueue_script( 'cptui', plugins_url( 'js/cptui.js', dirname(__FILE__) ), array( 'jquery', 'jquery-ui-core', 'jquery-ui-accordion' ), CPT_VERSION, true );
23
- wp_localize_script( 'cptui', 'confirmdata', array( 'confirm' => __( 'Are you sure you want to delete this?', 'cpt-plugin' ) ) );
 
 
 
 
 
 
24
  }
25
  add_action( 'admin_enqueue_scripts', 'cptui_post_type_enqueue_scripts' );
26
 
27
- /**
28
- * Add our settings page to the menu.
29
- *
30
- * @since 1.0.0
31
- */
32
- function cptui_post_types_admin_menu() {
33
- add_submenu_page( 'cptui_main_menu', __( 'Add/Edit Post Types', 'cpt-plugin' ), __( 'Add/Edit Post Types', 'cpt-plugin' ), 'manage_options', 'cptui_manage_post_types', 'cptui_manage_post_types' );
34
- }
35
- add_action( 'admin_menu', 'cptui_post_types_admin_menu' );
36
-
37
  /**
38
  * Create our settings page output.
39
  *
@@ -82,19 +83,28 @@ function cptui_manage_post_types() {
82
  # Will only be set if we're already on the edit screen
83
  if ( !empty( $post_types ) ) { ?>
84
  <form id="cptui_select_post_type" method="post">
85
- <p><?php _e( 'Select a post type to edit. DO NOT EDIT the post type slug unless necessary. Changing that value registers a new post type entry for your install.', 'cpt-plugin' ); ?></p>
86
- <?php
 
87
  cptui_post_types_dropdown( $post_types );
88
  ?>
89
- <input type="submit" class="button-secondary" name="cptui_select_post_type_submit" value="<?php echo esc_attr( apply_filters( 'cptui_post_type_submit_select', __( 'Select', 'cpt-plugin' ) ) ); ?>" />
90
  </form>
91
  <?php
 
 
 
 
 
 
 
 
 
92
  } ?>
93
 
94
  <form method="post">
95
  <table class="form-table cptui-table">
96
  <tr>
97
- <td><!--LEFT SIDE-->
98
  <table>
99
  <?php
100
 
@@ -143,33 +153,62 @@ function cptui_manage_post_types() {
143
  if ( isset( $current['description'] ) ) {
144
  $current['description'] = stripslashes_deep( $current['description'] );
145
  }
 
146
  echo $ui->get_textarea_input( array(
147
  'namearray' => 'cpt_custom_post_type',
148
  'name' => 'description',
149
  'rows' => '4',
150
  'cols' => '40',
151
- 'textvalue' => ( isset( $current['description'] ) ) ? esc_textarea( $current['description'] ) : '',
152
  'labeltext' => __('Description', 'cpt-plugin'),
153
  'helptext' => esc_attr__( 'Custom Post Type Description. Describe what your custom post type is used for.', 'cpt-plugin' )
154
  ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
  ?>
156
  </table>
157
  <p class="submit">
158
  <?php wp_nonce_field( 'cptui_addedit_post_type_nonce_action', 'cptui_addedit_post_type_nonce_field' );
159
  if ( !empty( $_GET ) && !empty( $_GET['action'] ) && 'edit' == $_GET['action'] ) { ?>
160
- <input type="submit" class="button-primary" name="cpt_submit" value="<?php echo esc_attr( apply_filters( 'cptui_post_type_submit_edit', __( 'Edit Post Type', 'cpt-plugin' ) ) ); ?>" />
161
  <input type="submit" class="button-secondary" name="cpt_delete" id="cpt_submit_delete" value="<?php echo esc_attr( apply_filters( 'cptui_post_type_submit_delete', __( 'Delete Post Type', 'cpt-plugin' ) ) ); ?>" />
162
  <?php } else { ?>
163
  <input type="submit" class="button-primary" name="cpt_submit" value="<?php echo esc_attr( apply_filters( 'cptui_post_type_submit_add', __( 'Add Post Type', 'cpt-plugin' ) ) ); ?>" />
164
  <?php } ?>
 
 
 
 
 
165
  <input type="hidden" name="cpt_type_status" id="cpt_type_status" value="<?php echo $tab; ?>" />
166
  </p>
167
- </td>
168
- <td>
169
- <p> <?php _e( 'Click headings to reveal available options.', 'cpt-plugin' ); ?></p>
170
 
171
- <div id="cptui_accordion">
172
- <h3 title="<?php esc_attr_e( 'Click to expand', 'cpt-plugin' ); ?>"><?php _e( 'Labels', 'cpt-plugin' ); ?></h3>
 
 
 
 
 
 
 
 
 
 
 
173
  <div>
174
  <table>
175
  <?php
@@ -331,7 +370,7 @@ function cptui_manage_post_types() {
331
  ?>
332
  </table>
333
  </div>
334
- <h3 title="<?php esc_attr_e( 'Click to expand', 'cpt-plugin' ); ?>"><?php _e( 'Settings', 'cpt-plugin' ); ?></h3>
335
  <div>
336
  <table>
337
  <?php
@@ -351,7 +390,7 @@ function cptui_manage_post_types() {
351
  'name' => 'public',
352
  'labeltext' => __( 'Public', 'cpt-plugin' ),
353
  'aftertext' => __( '(default: True)', 'cpt-plugin' ),
354
- 'helptext' => esc_attr__( 'Whether posts of this type should be shown in the admin UI.', 'cpt-plugin' ),
355
  'selections' => $select
356
  ) );
357
 
@@ -380,7 +419,7 @@ function cptui_manage_post_types() {
380
  */
381
  echo $ui->get_tr_start() . $ui->get_th_start();
382
  echo $ui->get_label( 'has_archive', __( 'Has Archive', 'cpt-plugin' ) );
383
- echo $ui->get_help( esc_attr__( 'Whether the post type will have a post type archive page.', 'cpt-plugin' ) );
384
  echo $ui->get_p( __( 'If left blank, the archive slug will default to the post type slug.', 'cpt-plugin' ) );
385
  echo $ui->get_th_end() . $ui->get_td_start();
386
 
@@ -407,7 +446,7 @@ function cptui_manage_post_types() {
407
  'namearray' => 'cpt_custom_post_type',
408
  'name' => 'has_archive_string',
409
  'textvalue' => ( isset( $current['has_archive_string'] ) ) ? esc_attr( $current['has_archive_string'] ) : '',
410
- 'helptext' => esc_attr__( 'Slug to be used for archive page.', 'cpt-plugin' ),
411
  'helptext_after'=> true,
412
  'wrap' => false
413
  ) );
@@ -429,7 +468,7 @@ function cptui_manage_post_types() {
429
  'name' => 'exclude_from_search',
430
  'labeltext' => __( 'Exclude From Search', 'cpt-plugin' ),
431
  'aftertext' => __( '(default: False)', 'cpt-plugin' ),
432
- 'helptext' => esc_attr__( 'Whether the post type will be searchable', 'cpt-plugin' ),
433
  'selections' => $select
434
  ) );
435
 
@@ -480,7 +519,7 @@ function cptui_manage_post_types() {
480
  'name' => 'rewrite',
481
  'labeltext' => __( 'Rewrite', 'cpt-plugin' ),
482
  'aftertext' => __( '(default: True)', 'cpt-plugin' ),
483
- 'helptext' => esc_attr__( 'Triggers the handling of rewrites for this post type', 'cpt-plugin' ),
484
  'selections' => $select
485
  ) );
486
 
@@ -492,8 +531,8 @@ function cptui_manage_post_types() {
492
  'name' => 'rewrite_slug',
493
  'textvalue' => ( isset( $current['rewrite_slug'] ) ) ? esc_attr( $current['rewrite_slug'] ) : '',
494
  'labeltext' => __( 'Custom Rewrite Slug', 'cpt-plugin' ),
495
- 'aftertext' => __( '(default: post type name)', 'cpt-plugin' ),
496
- 'helptext' => esc_attr__( 'Custom slug to use instead of the default.', 'cpt-plugin' ),
497
  ) );
498
 
499
  /*
@@ -532,7 +571,7 @@ function cptui_manage_post_types() {
532
  'name' => 'query_var',
533
  'labeltext' => __( 'Query Var', 'cpt-plugin' ),
534
  'aftertext' => __( '(default: True)', 'cpt-plugin' ),
535
- 'helptext' => esc_attr__( 'Should the permastruct be prepended with the front base.', 'cpt-plugin' ),
536
  'selections' => $select
537
  ) );
538
 
@@ -549,8 +588,6 @@ function cptui_manage_post_types() {
549
  'namearray' => 'cpt_custom_post_type',
550
  'name' => 'menu_position',
551
  'textvalue' => ( isset( $current['menu_position'] ) ) ? esc_attr( $current['menu_position'] ) : '',
552
- 'helptext' => esc_attr__( 'URL or Dashicon value for image to be used as menu icon.', 'cpt-plugin' ),
553
- 'helptext_after'=> true,
554
  'wrap' => false
555
  ) );
556
  echo $ui->get_td_end() . $ui->get_tr_end();
@@ -560,7 +597,7 @@ function cptui_manage_post_types() {
560
  */
561
  echo $ui->get_tr_start() . $ui->get_th_start();
562
  echo $ui->get_label( 'show_in_menu', __( 'Show in Menu', 'cpt-plugin' ) );
563
- echo $ui->get_help( esc_attr__( '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' ) );
564
  echo $ui->get_p( __( '"Show UI" must be "true". If an existing top level page such as "tools.php" is indicated for second input, post type will be sub menu of that.', 'cpt-plugin' ) );
565
  echo $ui->get_th_end() . $ui->get_td_start();
566
 
@@ -587,7 +624,7 @@ function cptui_manage_post_types() {
587
  'namearray' => 'cpt_custom_post_type',
588
  'name' => 'show_in_menu_string',
589
  'textvalue' => ( isset( $current['show_in_menu_string'] ) ) ? esc_attr( $current['show_in_menu_string'] ) : '',
590
- 'helptext' => esc_attr__( 'URL to image to be used as menu icon.', 'cpt-plugin' ),
591
  'helptext_after'=> true,
592
  'wrap' => false
593
  ) );
@@ -783,7 +820,19 @@ function cptui_manage_post_types() {
783
  'default' => false,
784
  'wrap' => false
785
  ) );
 
786
 
 
 
 
 
 
 
 
 
 
 
 
787
  echo $ui->get_td_end() . $ui->get_tr_end();
788
 
789
  echo $ui->get_tr_start() . $ui->get_th_start() . __( 'Built-in Taxonomies', 'cpt-plugin' ) . $ui->get_th_end() . $ui->get_td_start();
@@ -823,15 +872,6 @@ function cptui_manage_post_types() {
823
  echo $ui->get_td_end() . $ui->get_tr_end(); ?>
824
  </table>
825
  </div>
826
- <?php if ( 'new' == $tab ) { ?>
827
- <h3 title="<?php esc_attr_e( 'Click to expand', 'cpt-plugin' ); ?>"><?php _e( 'Starter Notes', 'cpt-plugin' ); ?></h3>
828
- <div><ol>
829
- <?php
830
- echo '<li>' . sprintf( __( 'Post Type names should have %smax 20 characters%s, and only contain alphanumeric, lowercase characters, underscores in place of spaces and letters that do not have accents. Reserved names: post, page, attachment, revision, nav_menu_item.', 'cpt-plugin' ), '<strong class="wp-ui-highlight">', '</strong>' );
831
- echo '<li>' . sprintf( __( 'If you are unfamiliar with the advanced post type settings, just fill in the %sPost Type Name%s and %sLabel%s fields. Remaining settings will use default values. Labels, if left blank, will be automatically created based on the post type name. Hover over the question mark for more details.', 'cpt-plugin' ), '<strong class="wp-ui-highlight">', '</strong>', '<strong class="wp-ui-highlight">', '</strong>' );
832
- echo '<li>' . sprintf( __( 'Deleting custom post types will %sNOT%s 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' ), '<strong class="wp-ui-highlight">', '</strong>' ); ?>
833
- </ol></div>
834
- <?php } ?>
835
  </div>
836
  </td>
837
  </tr>
@@ -858,8 +898,6 @@ function cptui_post_types_dropdown( $post_types = array() ) {
858
  $select = array();
859
  $select['options'] = array();
860
 
861
- $select['options'][] = array( 'attr' => '', 'text' => '--' );
862
-
863
  foreach( $post_types as $type ) {
864
  $select['options'][] = array( 'attr' => $type['name'], 'text' => $type['label'] );
865
  }
@@ -884,7 +922,7 @@ function cptui_post_types_dropdown( $post_types = array() ) {
884
  * @return bool|string $value False on no result, sanitized post type if set.
885
  */
886
  function cptui_get_current_post_type() {
887
- if ( !empty( $_POST ) ) {
888
  if ( isset( $_POST['cptui_selected_post_type']['post_type'] ) ) {
889
  return sanitize_text_field( $_POST['cptui_selected_post_type']['post_type'] );
890
  }
@@ -892,6 +930,14 @@ function cptui_get_current_post_type() {
892
  if ( isset( $_POST['cpt_custom_post_type']['name'] ) ) {
893
  return sanitize_text_field( $_POST['cpt_custom_post_type']['name'] );
894
  }
 
 
 
 
 
 
 
 
895
  }
896
 
897
  return false;
@@ -908,7 +954,15 @@ function cptui_get_current_post_type() {
908
  */
909
  function cptui_delete_post_type( $data = array() ) {
910
 
911
- if ( empty( $data['cpt_custom_post_type']['name'] ) ) {
 
 
 
 
 
 
 
 
912
  return cptui_admin_notices( 'error', '', false, __( 'Please provide a post type to delete', 'cpt-plugin' ) );
913
  }
914
 
@@ -972,6 +1026,12 @@ function cptui_update_post_type( $data = array() ) {
972
  return cptui_admin_notices( 'error', '', false, __( 'Please provide a post type name', 'cpt-plugin' ) );
973
  }
974
 
 
 
 
 
 
 
975
  # clean up $_POST data
976
  foreach( $data as $key => $value ) {
977
  if ( is_string( $value ) ) {
@@ -1012,7 +1072,7 @@ function cptui_update_post_type( $data = array() ) {
1012
 
1013
  $label = str_replace( '"', '', htmlspecialchars_decode( $label ) );
1014
  $label = htmlspecialchars( $label, ENT_QUOTES );
1015
-
1016
  $data['cpt_labels'][ $key ] = stripslashes_deep( $label );
1017
  }
1018
 
@@ -1026,31 +1086,40 @@ function cptui_update_post_type( $data = array() ) {
1026
  $singular_label = str_replace( '"', '', htmlspecialchars_decode( $data['cpt_custom_post_type']['singular_label'] ) );
1027
  $singular_label = htmlspecialchars( stripslashes( $singular_label ), ENT_QUOTES );
1028
 
 
1029
  $description = stripslashes_deep( $data['cpt_custom_post_type']['description'] );
 
 
 
 
 
 
 
1030
 
1031
  $post_types[ $data['cpt_custom_post_type']['name'] ] = array(
1032
- 'name' => $data['cpt_custom_post_type']['name'],
1033
  'label' => $label,
1034
  'singular_label' => $singular_label,
1035
  'description' => $description,
1036
  'public' => disp_boolean( $data['cpt_custom_post_type']['public'] ),
1037
  'show_ui' => disp_boolean( $data['cpt_custom_post_type']['show_ui'] ),
1038
  'has_archive' => disp_boolean( $data['cpt_custom_post_type']['has_archive'] ),
1039
- 'has_archive_string' => $data['cpt_custom_post_type']['has_archive_string'],
1040
  'exclude_from_search' => disp_boolean( $data['cpt_custom_post_type']['exclude_from_search'] ),
1041
- 'capability_type' => $data['cpt_custom_post_type']['capability_type'],
1042
  'hierarchical' => disp_boolean( $data['cpt_custom_post_type']['hierarchical'] ),
1043
  'rewrite' => disp_boolean( $data['cpt_custom_post_type']['rewrite'] ),
1044
- 'rewrite_slug' => $data['cpt_custom_post_type']['rewrite_slug'],
1045
  'rewrite_withfront' => disp_boolean( $data['cpt_custom_post_type']['rewrite_withfront'] ),
1046
  'query_var' => disp_boolean( $data['cpt_custom_post_type']['query_var'] ),
1047
- 'menu_position' => $data['cpt_custom_post_type']['menu_position'],
1048
  'show_in_menu' => disp_boolean( $data['cpt_custom_post_type']['show_in_menu'] ),
1049
- 'show_in_menu_string' => $data['cpt_custom_post_type']['show_in_menu_string'],
1050
- 'menu_icon' => $data['cpt_custom_post_type']['menu_icon'],
1051
  'supports' => $data['cpt_supports'],
1052
  'taxonomies' => $data['cpt_addon_taxes'],
1053
- 'labels' => $data['cpt_labels']
 
1054
  );
1055
 
1056
  $success = update_option( 'cptui_post_types', $post_types );
@@ -1103,3 +1172,25 @@ function cptui_reserved_post_types() {
1103
  'theme'
1104
  ) );
1105
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  return;
20
  }
21
 
22
+ /*$post_types = get_option( 'cptui_post_types' );
23
+ foreach( $post_types as $type ) {
24
+ $types[] = $type['name'];
25
+ }*/
26
+
27
  wp_enqueue_script( 'cptui', plugins_url( 'js/cptui.js', dirname(__FILE__) ), array( 'jquery', 'jquery-ui-core', 'jquery-ui-accordion' ), CPT_VERSION, true );
28
+ wp_localize_script( 'cptui', 'cptui_type_data',
29
+ array(
30
+ 'confirm' => __( 'Are you sure you want to delete this?', 'cpt-plugin' ),
31
+ # 'post_types' => $types,
32
+ #'post_change_name' => '<div class="typetax-rename">' . __( 'Changing this will rename the post type.', 'cpt-plugin' ) . '</div>'
33
+ )
34
+ );
35
  }
36
  add_action( 'admin_enqueue_scripts', 'cptui_post_type_enqueue_scripts' );
37
 
 
 
 
 
 
 
 
 
 
 
38
  /**
39
  * Create our settings page output.
40
  *
83
  # Will only be set if we're already on the edit screen
84
  if ( !empty( $post_types ) ) { ?>
85
  <form id="cptui_select_post_type" method="post">
86
+ <p><?php _e( 'DO NOT EDIT the post type slug unless necessary. Changing that value registers a new post type entry for your install.', 'cpt-plugin' ); ?></p>
87
+ <p><?php _e( 'Use appropriate checkbox above save/delete buttons if you wish to change slugs and update post types for existing posts.', 'cpt-plugin' ); ?></p>
88
+ <?php _e( 'Select: ', 'cpt-plugin' );
89
  cptui_post_types_dropdown( $post_types );
90
  ?>
 
91
  </form>
92
  <?php
93
+
94
+ /**
95
+ * Fires below the post type select input.
96
+ *
97
+ * @since 1.1.0
98
+ *
99
+ * @param string $value Current post type selected.
100
+ */
101
+ do_action( 'cptui_below_post_type_select', $current['name'] );
102
  } ?>
103
 
104
  <form method="post">
105
  <table class="form-table cptui-table">
106
  <tr>
107
+ <td class="outter">
108
  <table>
109
  <?php
110
 
153
  if ( isset( $current['description'] ) ) {
154
  $current['description'] = stripslashes_deep( $current['description'] );
155
  }
156
+
157
  echo $ui->get_textarea_input( array(
158
  'namearray' => 'cpt_custom_post_type',
159
  'name' => 'description',
160
  'rows' => '4',
161
  'cols' => '40',
162
+ 'textvalue' => ( isset( $current['description'] ) ) ? esc_textarea( $current['description'] ) : '',
163
  'labeltext' => __('Description', 'cpt-plugin'),
164
  'helptext' => esc_attr__( 'Custom Post Type Description. Describe what your custom post type is used for.', 'cpt-plugin' )
165
  ) );
166
+
167
+ /*
168
+ * Migrate posts
169
+ */
170
+ if ( 'edit' == $tab ) {
171
+ echo $ui->get_check_input( array(
172
+ 'checkvalue' => 'update_post_types',
173
+ 'checked' => 'false',
174
+ 'name' => 'update_post_types',
175
+ 'namearray' => 'update_post_types',
176
+ 'labeltext' => __( 'Migrate posts to newly renamed post type?', 'cpt-plugin' ),
177
+ 'helptext' => esc_attr__( 'Check this to migrate posts if and when renaming your post type.', 'cpt-plugin' ),
178
+ 'default' => false
179
+ ) );
180
+ }
181
  ?>
182
  </table>
183
  <p class="submit">
184
  <?php wp_nonce_field( 'cptui_addedit_post_type_nonce_action', 'cptui_addedit_post_type_nonce_field' );
185
  if ( !empty( $_GET ) && !empty( $_GET['action'] ) && 'edit' == $_GET['action'] ) { ?>
186
+ <input type="submit" class="button-primary" name="cpt_submit" value="<?php echo esc_attr( apply_filters( 'cptui_post_type_submit_edit', __( 'Save Post Type', 'cpt-plugin' ) ) ); ?>" />
187
  <input type="submit" class="button-secondary" name="cpt_delete" id="cpt_submit_delete" value="<?php echo esc_attr( apply_filters( 'cptui_post_type_submit_delete', __( 'Delete Post Type', 'cpt-plugin' ) ) ); ?>" />
188
  <?php } else { ?>
189
  <input type="submit" class="button-primary" name="cpt_submit" value="<?php echo esc_attr( apply_filters( 'cptui_post_type_submit_add', __( 'Add Post Type', 'cpt-plugin' ) ) ); ?>" />
190
  <?php } ?>
191
+
192
+ <?php if ( !empty( $current ) ) { ?>
193
+ <input type="hidden" name="cpt_original" id="cpt_original" value="<?php echo $current['name']; ?>" />
194
+ <?php } ?>
195
+
196
  <input type="hidden" name="cpt_type_status" id="cpt_type_status" value="<?php echo $tab; ?>" />
197
  </p>
 
 
 
198
 
199
+ <?php if ( 'new' == $tab ) { ?>
200
+ <h3><?php _e( 'Starter Notes', 'cpt-plugin' ); ?></h3>
201
+ <div><ol>
202
+ <?php
203
+ echo '<li>' . sprintf( __( 'Post Type names should have %smax 20 characters%s, and only contain alphanumeric, lowercase characters, underscores in place of spaces and letters that do not have accents. Reserved names: post, page, attachment, revision, nav_menu_item.', 'cpt-plugin' ), '<strong class="wp-ui-highlight">', '</strong>' );
204
+ echo '<li>' . sprintf( __( 'If you are unfamiliar with the advanced post type settings, just fill in the %sPost Type Name%s and %sLabel%s fields. Remaining settings will use default values. Labels, if left blank, will be automatically created based on the post type name. Hover over the question mark for more details.', 'cpt-plugin' ), '<strong class="wp-ui-highlight">', '</strong>', '<strong class="wp-ui-highlight">', '</strong>' );
205
+ echo '<li>' . sprintf( __( 'Deleting custom post types will %sNOT%s 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' ), '<strong class="wp-ui-highlight">', '</strong>' ); ?>
206
+ </ol></div>
207
+ <?php } ?>
208
+ </td>
209
+ <td class="outter">
210
+ <div>
211
+ <h3><?php _e( 'Labels', 'cpt-plugin' ); ?></h3>
212
  <div>
213
  <table>
214
  <?php
370
  ?>
371
  </table>
372
  </div>
373
+ <h3><?php _e( 'Settings', 'cpt-plugin' ); ?></h3>
374
  <div>
375
  <table>
376
  <?php
390
  'name' => 'public',
391
  'labeltext' => __( 'Public', 'cpt-plugin' ),
392
  'aftertext' => __( '(default: True)', 'cpt-plugin' ),
393
+ 'helptext' => esc_attr__( 'Whether posts of this type should be shown in the admin UI and is publicly queryable.', 'cpt-plugin' ),
394
  'selections' => $select
395
  ) );
396
 
419
  */
420
  echo $ui->get_tr_start() . $ui->get_th_start();
421
  echo $ui->get_label( 'has_archive', __( 'Has Archive', 'cpt-plugin' ) );
422
+ echo $ui->get_help( esc_attr__( 'Whether the post type will have a post type archive URL.', 'cpt-plugin' ) );
423
  echo $ui->get_p( __( 'If left blank, the archive slug will default to the post type slug.', 'cpt-plugin' ) );
424
  echo $ui->get_th_end() . $ui->get_td_start();
425
 
446
  'namearray' => 'cpt_custom_post_type',
447
  'name' => 'has_archive_string',
448
  'textvalue' => ( isset( $current['has_archive_string'] ) ) ? esc_attr( $current['has_archive_string'] ) : '',
449
+ 'helptext' => esc_attr__( 'Slug to be used for archive URL.', 'cpt-plugin' ),
450
  'helptext_after'=> true,
451
  'wrap' => false
452
  ) );
468
  'name' => 'exclude_from_search',
469
  'labeltext' => __( 'Exclude From Search', 'cpt-plugin' ),
470
  'aftertext' => __( '(default: False)', 'cpt-plugin' ),
471
+ 'helptext' => esc_attr__( 'Whether to exclude posts with this post type from front end search results.', 'cpt-plugin' ),
472
  'selections' => $select
473
  ) );
474
 
519
  'name' => 'rewrite',
520
  'labeltext' => __( 'Rewrite', 'cpt-plugin' ),
521
  'aftertext' => __( '(default: True)', 'cpt-plugin' ),
522
+ 'helptext' => esc_attr__( 'Whether or not WordPress should use rewrites for this post type', 'cpt-plugin' ),
523
  'selections' => $select
524
  ) );
525
 
531
  'name' => 'rewrite_slug',
532
  'textvalue' => ( isset( $current['rewrite_slug'] ) ) ? esc_attr( $current['rewrite_slug'] ) : '',
533
  'labeltext' => __( 'Custom Rewrite Slug', 'cpt-plugin' ),
534
+ 'aftertext' => __( '(default: post type slug)', 'cpt-plugin' ),
535
+ 'helptext' => esc_attr__( 'Custom post type slug to use instead of the default.', 'cpt-plugin' ),
536
  ) );
537
 
538
  /*
571
  'name' => 'query_var',
572
  'labeltext' => __( 'Query Var', 'cpt-plugin' ),
573
  'aftertext' => __( '(default: True)', 'cpt-plugin' ),
574
+ 'helptext' => esc_attr__( 'Sets the query_var key for this post type.', 'cpt-plugin' ),
575
  'selections' => $select
576
  ) );
577
 
588
  'namearray' => 'cpt_custom_post_type',
589
  'name' => 'menu_position',
590
  'textvalue' => ( isset( $current['menu_position'] ) ) ? esc_attr( $current['menu_position'] ) : '',
 
 
591
  'wrap' => false
592
  ) );
593
  echo $ui->get_td_end() . $ui->get_tr_end();
597
  */
598
  echo $ui->get_tr_start() . $ui->get_th_start();
599
  echo $ui->get_label( 'show_in_menu', __( 'Show in Menu', 'cpt-plugin' ) );
600
+ echo $ui->get_help( esc_attr__( 'Whether to show the post type in the admin menu and where to show that menu.', 'cpt-plugin' ) );
601
  echo $ui->get_p( __( '"Show UI" must be "true". If an existing top level page such as "tools.php" is indicated for second input, post type will be sub menu of that.', 'cpt-plugin' ) );
602
  echo $ui->get_th_end() . $ui->get_td_start();
603
 
624
  'namearray' => 'cpt_custom_post_type',
625
  'name' => 'show_in_menu_string',
626
  'textvalue' => ( isset( $current['show_in_menu_string'] ) ) ? esc_attr( $current['show_in_menu_string'] ) : '',
627
+ 'helptext' => esc_attr__( 'Top-level page file name to make post type a sub-menu of.', 'cpt-plugin' ),
628
  'helptext_after'=> true,
629
  'wrap' => false
630
  ) );
820
  'default' => false,
821
  'wrap' => false
822
  ) );
823
+ echo $ui->get_td_end() . $ui->get_tr_end();
824
 
825
+ echo $ui->get_tr_start() . $ui->get_th_start() . __( 'Custom "Supports"', 'cpt-plugin' );
826
+ echo $ui->get_p( __( 'Use this input to register custom "supports" values, separated by commas.', 'cpt-plugin' ) );
827
+ echo $ui->get_th_end() . $ui->get_td_start();
828
+ echo $ui->get_text_input( array(
829
+ 'namearray' => 'cpt_custom_post_type',
830
+ 'name' => 'custom_supports',
831
+ 'textvalue' => ( isset( $current['custom_supports'] ) ) ? esc_attr( $current['custom_supports'] ) : '',
832
+ 'helptext' => esc_attr__( 'Provide custom support slugs here.', 'cpt-plugin' ),
833
+ 'helptext_after'=> true,
834
+ 'wrap' => false
835
+ ) );
836
  echo $ui->get_td_end() . $ui->get_tr_end();
837
 
838
  echo $ui->get_tr_start() . $ui->get_th_start() . __( 'Built-in Taxonomies', 'cpt-plugin' ) . $ui->get_th_end() . $ui->get_td_start();
872
  echo $ui->get_td_end() . $ui->get_tr_end(); ?>
873
  </table>
874
  </div>
 
 
 
 
 
 
 
 
 
875
  </div>
876
  </td>
877
  </tr>
898
  $select = array();
899
  $select['options'] = array();
900
 
 
 
901
  foreach( $post_types as $type ) {
902
  $select['options'][] = array( 'attr' => $type['name'], 'text' => $type['label'] );
903
  }
922
  * @return bool|string $value False on no result, sanitized post type if set.
923
  */
924
  function cptui_get_current_post_type() {
925
+ if ( ! empty( $_POST ) ) {
926
  if ( isset( $_POST['cptui_selected_post_type']['post_type'] ) ) {
927
  return sanitize_text_field( $_POST['cptui_selected_post_type']['post_type'] );
928
  }
930
  if ( isset( $_POST['cpt_custom_post_type']['name'] ) ) {
931
  return sanitize_text_field( $_POST['cpt_custom_post_type']['name'] );
932
  }
933
+ } else if ( !empty( $_GET ) && isset( $_GET['cptui_post_type'] ) ) {
934
+ return sanitize_text_field( $_GET['cptui_post_type'] );
935
+ } else {
936
+ $post_types = get_option( 'cptui_post_types' );
937
+ if ( !empty( $post_types ) ) {
938
+ # Will return the first array key
939
+ return key( $post_types );
940
+ }
941
  }
942
 
943
  return false;
954
  */
955
  function cptui_delete_post_type( $data = array() ) {
956
 
957
+ if ( is_string( $data ) && post_type_exists( $data ) ) {
958
+ $data = array(
959
+ 'cpt_custom_post_type' => array(
960
+ 'name' => $data
961
+ )
962
+ );
963
+ }
964
+
965
+ if ( empty( $data['cpt_custom_post_type']['name'] ) || ! post_type_exists( $data['cpt_custom_post_type']['name'] ) ) {
966
  return cptui_admin_notices( 'error', '', false, __( 'Please provide a post type to delete', 'cpt-plugin' ) );
967
  }
968
 
1026
  return cptui_admin_notices( 'error', '', false, __( 'Please provide a post type name', 'cpt-plugin' ) );
1027
  }
1028
 
1029
+ if ( !empty( $data['cpt_original'] ) && $data['cpt_original'] != $data['cpt_custom_post_type']['name'] ) {
1030
+ if ( !empty( $data['update_post_types'] ) ) {
1031
+ cptui_convert_post_type_posts( $data['cpt_original'], $data['cpt_custom_post_type']['name'] );
1032
+ }
1033
+ }
1034
+
1035
  # clean up $_POST data
1036
  foreach( $data as $key => $value ) {
1037
  if ( is_string( $value ) ) {
1072
 
1073
  $label = str_replace( '"', '', htmlspecialchars_decode( $label ) );
1074
  $label = htmlspecialchars( $label, ENT_QUOTES );
1075
+ $label = trim( $label );
1076
  $data['cpt_labels'][ $key ] = stripslashes_deep( $label );
1077
  }
1078
 
1086
  $singular_label = str_replace( '"', '', htmlspecialchars_decode( $data['cpt_custom_post_type']['singular_label'] ) );
1087
  $singular_label = htmlspecialchars( stripslashes( $singular_label ), ENT_QUOTES );
1088
 
1089
+ $name = trim( $data['cpt_custom_post_type']['name'] );
1090
  $description = stripslashes_deep( $data['cpt_custom_post_type']['description'] );
1091
+ $has_archive_string = trim( $data['cpt_custom_post_type']['has_archive_string'] );
1092
+ $capability_type = trim( $data['cpt_custom_post_type']['capability_type'] );
1093
+ $rewrite_slug = trim( $data['cpt_custom_post_type']['rewrite_slug'] );
1094
+ $menu_position = trim( $data['cpt_custom_post_type']['menu_position'] );
1095
+ $show_in_menu_string = trim( $data['cpt_custom_post_type']['show_in_menu_string'] );
1096
+ $menu_icon = trim( $data['cpt_custom_post_type']['menu_icon'] );
1097
+ $custom_supports = trim( $data['cpt_custom_post_type']['custom_supports'] );
1098
 
1099
  $post_types[ $data['cpt_custom_post_type']['name'] ] = array(
1100
+ 'name' => $name,
1101
  'label' => $label,
1102
  'singular_label' => $singular_label,
1103
  'description' => $description,
1104
  'public' => disp_boolean( $data['cpt_custom_post_type']['public'] ),
1105
  'show_ui' => disp_boolean( $data['cpt_custom_post_type']['show_ui'] ),
1106
  'has_archive' => disp_boolean( $data['cpt_custom_post_type']['has_archive'] ),
1107
+ 'has_archive_string' => $has_archive_string,
1108
  'exclude_from_search' => disp_boolean( $data['cpt_custom_post_type']['exclude_from_search'] ),
1109
+ 'capability_type' => $capability_type,
1110
  'hierarchical' => disp_boolean( $data['cpt_custom_post_type']['hierarchical'] ),
1111
  'rewrite' => disp_boolean( $data['cpt_custom_post_type']['rewrite'] ),
1112
+ 'rewrite_slug' => $rewrite_slug,
1113
  'rewrite_withfront' => disp_boolean( $data['cpt_custom_post_type']['rewrite_withfront'] ),
1114
  'query_var' => disp_boolean( $data['cpt_custom_post_type']['query_var'] ),
1115
+ 'menu_position' => $menu_position,
1116
  'show_in_menu' => disp_boolean( $data['cpt_custom_post_type']['show_in_menu'] ),
1117
+ 'show_in_menu_string' => $show_in_menu_string,
1118
+ 'menu_icon' => $menu_icon,
1119
  'supports' => $data['cpt_supports'],
1120
  'taxonomies' => $data['cpt_addon_taxes'],
1121
+ 'labels' => $data['cpt_labels'],
1122
+ 'custom_supports' => $custom_supports
1123
  );
1124
 
1125
  $success = update_option( 'cptui_post_types', $post_types );
1172
  'theme'
1173
  ) );
1174
  }
1175
+
1176
+ /**
1177
+ * Converts post type between original and newly renamed.
1178
+ *
1179
+ * @since 1.1.0
1180
+ *
1181
+ * @param string $original_slug Original post type slug.
1182
+ * @param string $new_slug New post type slug.
1183
+ */
1184
+ function cptui_convert_post_type_posts( $original_slug = '', $new_slug = '' ) {
1185
+ $args = array(
1186
+ 'posts_per_page' => -1,
1187
+ 'post_type' => $original_slug
1188
+ );
1189
+ $convert = new WP_Query( $args );
1190
+
1191
+ if ( $convert->have_posts() ) : while ( $convert->have_posts() ) : $convert->the_post();
1192
+ set_post_type( get_the_ID(), $new_slug );
1193
+ endwhile; endif;
1194
+
1195
+ cptui_delete_post_type( $original_slug );
1196
+ }
inc/support.php CHANGED
@@ -21,16 +21,6 @@ function cptui_support_enqueue_scripts() {
21
  }
22
  add_action( 'admin_enqueue_scripts', 'cptui_support_enqueue_scripts' );
23
 
24
- /**
25
- * Add our settings page to the menu.
26
- *
27
- * @since 1.0.0
28
- */
29
- function cptui_support_admin_menu() {
30
- add_submenu_page( 'cptui_main_menu', __( 'Help/Support', 'cpt-plugin' ), __( 'Help/Support', 'cpt-plugin' ), 'manage_options', 'cptui_support', 'cptui_support' );
31
- }
32
- add_action( 'admin_menu', 'cptui_support_admin_menu' );
33
-
34
  /**
35
  * Create our settings page output.
36
  *
@@ -56,7 +46,7 @@ function cptui_support() {
56
 
57
  <table id="support" class="form-table cptui-table">
58
  <tr>
59
- <td>
60
  <h2><?php _e( 'General', 'cpt-plugin' ); ?></h2>
61
  <ol id="questions_general">
62
  <li>
@@ -75,7 +65,7 @@ function cptui_support() {
75
  </li>
76
  </ol>
77
  </td>
78
- <td>
79
  <h2><?php _e( 'Front-end Display', 'cpt-plugin' ); ?></h2>
80
  <ol id="questions_front">
81
  <li>
@@ -103,7 +93,7 @@ function cptui_support() {
103
  </td>
104
  </tr>
105
  <tr>
106
- <td>
107
  <h2><?php _e( 'Advanced', 'cpt-plugin' ); ?></h2>
108
  <ol id="questions_advanced">
109
  <li>
@@ -132,6 +122,11 @@ function cptui_support() {
132
  '</a>'
133
  ); ?></div>
134
  </li>
 
 
 
 
 
135
  <li>
136
  <span class="question"><?php _e( 'How do I filter the "enter title here" text in the post editor screen?', 'cpt-plugin' ); ?></span>
137
  <div class="answer"><p><?php _e( 'Change text inside the post/page editor title field. Should be able to adapt as necessary.', 'cpt-plugin' ); ?></p>
@@ -146,7 +141,7 @@ add_filter( 'enter_title_here', 'my_custom_title_text' );
146
  </li>
147
  </ol>
148
  </td>
149
- <td>
150
  &nbsp;
151
  <?php
152
 
21
  }
22
  add_action( 'admin_enqueue_scripts', 'cptui_support_enqueue_scripts' );
23
 
 
 
 
 
 
 
 
 
 
 
24
  /**
25
  * Create our settings page output.
26
  *
46
 
47
  <table id="support" class="form-table cptui-table">
48
  <tr>
49
+ <td class="outter">
50
  <h2><?php _e( 'General', 'cpt-plugin' ); ?></h2>
51
  <ol id="questions_general">
52
  <li>
65
  </li>
66
  </ol>
67
  </td>
68
+ <td class="outter">
69
  <h2><?php _e( 'Front-end Display', 'cpt-plugin' ); ?></h2>
70
  <ol id="questions_front">
71
  <li>
93
  </td>
94
  </tr>
95
  <tr>
96
+ <td class="outter">
97
  <h2><?php _e( 'Advanced', 'cpt-plugin' ); ?></h2>
98
  <ol id="questions_advanced">
99
  <li>
122
  '</a>'
123
  ); ?></div>
124
  </li>
125
+ <li>
126
+ <span class="question"><?php _e( 'Is there any function reference list?', 'cpt-plugin' ); ?></span>
127
+ <div class="answer"><?php printf( __( '%s has compiled a nice list of functions used by our plugin. Note not all will be useful as they are attached to hooks.', 'cpt-plugin' ),
128
+ '<a href="http://hookr.io/plugins/custom-post-type-ui/1.0.5/all/#index=c" target="_blank">Hookr.io</a>' ); ?></div>
129
+ </li>
130
  <li>
131
  <span class="question"><?php _e( 'How do I filter the "enter title here" text in the post editor screen?', 'cpt-plugin' ); ?></span>
132
  <div class="answer"><p><?php _e( 'Change text inside the post/page editor title field. Should be able to adapt as necessary.', 'cpt-plugin' ); ?></p>
141
  </li>
142
  </ol>
143
  </td>
144
+ <td class="outter">
145
  &nbsp;
146
  <?php
147
 
inc/taxonomies.php CHANGED
@@ -20,20 +20,15 @@ function cptui_taxonomies_enqueue_scripts() {
20
  }
21
 
22
  wp_enqueue_script( 'cptui', plugins_url( 'js/cptui.js' , dirname(__FILE__) ) . '', array( 'jquery', 'jquery-ui-core', 'jquery-ui-accordion' ), CPT_VERSION, true );
23
- wp_localize_script( 'cptui', 'confirmdata', array( 'confirm' => __( 'Are you sure you want to delete this?', 'cpt-plugin' ) ) );
 
 
 
 
 
24
  }
25
  add_action( 'admin_enqueue_scripts', 'cptui_taxonomies_enqueue_scripts' );
26
 
27
- /**
28
- * Add our settings page to the menu.
29
- *
30
- * @since 1.0.0
31
- */
32
- function cptui_taxonomies_admin_menu() {
33
- add_submenu_page( 'cptui_main_menu', __( 'Add/Edit Taxonomies', 'cpt-plugin' ), __( 'Add/Edit Taxonomies', 'cpt-plugin' ), 'manage_options', 'cptui_manage_taxonomies', 'cptui_manage_taxonomies' );
34
- }
35
- add_action( 'admin_menu', 'cptui_taxonomies_admin_menu' );
36
-
37
  /**
38
  * Create our settings page output.
39
  *
@@ -84,19 +79,28 @@ function cptui_manage_taxonomies() {
84
  # Will only be set if we're already on the edit screen
85
  if ( !empty( $taxonomies ) ) { ?>
86
  <form id="cptui_select_taxonomy" method="post">
87
- <p><?php _e( 'Select a taxonomy to edit. DO NOT EDIT the taxonomy slug unless necessary. Changing that value registers a new taxonomy entry for your install.', 'cpt-plugin' ); ?></p>
88
  <?php
 
89
  cptui_taxonomies_dropdown( $taxonomies );
90
  ?>
91
- <input type="submit" class="button-secondary" name="cptui_select_taxonomy_submit" value="<?php echo esc_attr( apply_filters( 'cptui_taxonomy_submit_select', __( 'Select', 'cpt-plugin' ) ) ); ?>" />
92
  </form>
93
  <?php
 
 
 
 
 
 
 
 
 
94
  } ?>
95
 
96
  <form method="post">
97
  <table class="form-table cptui-table">
98
  <tr>
99
- <td><!--LEFT SIDE-->
100
  <table>
101
  <?php
102
 
@@ -107,7 +111,7 @@ function cptui_manage_taxonomies() {
107
  'maxlength' => '32',
108
  'onblur' => 'this.value=this.value.toLowerCase()',
109
  'labeltext' => __( 'Taxonomy Slug', 'cpt-plugin' ),
110
- 'aftertext' => __( '(e.g. actors)', 'cpt-plugin' ),
111
  'helptext' => esc_attr__( 'The taxonomy name. Used to retrieve custom taxonomy content. Should be short and unique', 'cpt-plugin'),
112
  'required' => true,
113
  ) );
@@ -169,19 +173,27 @@ function cptui_manage_taxonomies() {
169
  <p class="submit">
170
  <?php wp_nonce_field( 'cptui_addedit_taxonomy_nonce_action', 'cptui_addedit_taxonomy_nonce_field' );
171
  if ( !empty( $_GET ) && !empty( $_GET['action'] ) && 'edit' == $_GET['action'] ) { ?>
172
- <input type="submit" class="button-primary" name="cpt_submit" value="<?php echo esc_attr( apply_filters( 'cptui_taxonomy_submit_edit', __( 'Edit Taxonomy', 'cpt-plugin' ) ) ); ?>" />
173
  <input type="submit" class="button-secondary" name="cpt_delete" id="cpt_submit_delete" value="<?php echo apply_filters( 'cptui_taxonomy_submit_delete', __( 'Delete Taxonomy', 'cpt-plugin' ) ); ?>" />
174
  <?php } else { ?>
175
  <input type="submit" class="button-primary" name="cpt_submit" value="<?php echo esc_attr( apply_filters( 'cptui_taxonomy_submit_add', __( 'Add Taxonomy', 'cpt-plugin' ) ) ); ?>" />
176
  <?php } ?>
177
  <input type="hidden" name="cpt_tax_status" id="cpt_tax_status" value="<?php echo $tab; ?>" />
178
  </p>
179
- </td>
180
- <td>
181
- <p><?php _e( 'Click headings to reveal available options.', 'cpt-plugin' ); ?></p>
182
 
183
- <div id="cptui_accordion">
184
- <h3 title="<?php esc_attr_e( 'Click to expand', 'cpt-plugin' ); ?>"><?php _e( 'Labels', 'cpt-plugin' ); ?></h3>
 
 
 
 
 
 
 
 
 
 
 
185
  <div>
186
  <table>
187
  <?php
@@ -323,7 +335,7 @@ function cptui_manage_taxonomies() {
323
  ?>
324
  </table>
325
  </div>
326
- <h3 title="<?php esc_attr_e( 'Click to expand', 'cpt-plugin' ); ?>"><?php _e( 'Settings', 'cpt-plugin' ); ?></h3>
327
  <div>
328
  <table>
329
  <?php
@@ -357,7 +369,7 @@ function cptui_manage_taxonomies() {
357
  'name' => 'show_ui',
358
  'labeltext' => __( 'Show UI', 'cpt-plugin' ),
359
  'aftertext' => __( '(default: True)', 'cpt-plugin' ),
360
- 'helptext' => esc_attr__( 'Whether to generate a default UI for managing this custom taxonomy', 'cpt-plugin' ),
361
  'selections' => $select
362
  ) );
363
 
@@ -374,6 +386,7 @@ function cptui_manage_taxonomies() {
374
  'name' => 'query_var',
375
  'labeltext' => __( 'Query Var', 'cpt-plugin' ),
376
  'aftertext' => __( '(default: True)', 'cpt-plugin' ),
 
377
  'selections' => $select
378
  ) );
379
 
@@ -383,7 +396,7 @@ function cptui_manage_taxonomies() {
383
  'textvalue' => ( isset( $current['query_var_slug'] ) ) ? esc_attr( $current['query_var_slug'] ) : '',
384
  'aftertext' => __( '(default: none). Query Var needs to be true to use.', 'cpt-plugin' ),
385
  'labeltext' => __( 'Custom Query Var String', 'cpt-plugin' ),
386
- 'helptext' => esc_attr__( 'Custom Query Var Slug', 'cpt-plugin'),
387
  ) );
388
 
389
  $select = array(
@@ -399,7 +412,7 @@ function cptui_manage_taxonomies() {
399
  'name' => 'rewrite',
400
  'labeltext' => __( 'Rewrite', 'cpt-plugin' ),
401
  'aftertext' => __( '(default: True)', 'cpt-plugin' ),
402
- 'helptext' => esc_attr__( 'Triggers the handling of rewrites for this taxonomy', 'cpt-plugin' ),
403
  'selections' => $select
404
  ) );
405
 
@@ -409,7 +422,7 @@ function cptui_manage_taxonomies() {
409
  'textvalue' => ( isset( $current['rewrite_slug'] ) ) ? esc_attr( $current['rewrite_slug'] ) : '',
410
  'aftertext' => __( '(default: taxonomy name)', 'cpt-plugin' ),
411
  'labeltext' => __( 'Custom Rewrite Slug', 'cpt-plugin' ),
412
- 'helptext' => esc_attr__( 'Custom Taxonomy Rewrite Slug', 'cpt-plugin'),
413
  ) );
414
 
415
  $select = array(
@@ -465,16 +478,6 @@ function cptui_manage_taxonomies() {
465
  ?>
466
  </table>
467
  </div>
468
-
469
- <?php if ( 'new' == $tab ) { ?>
470
- <h3 title="<?php esc_attr_e( 'Click to expand', 'cpt-plugin' ); ?>"><?php _e( 'Starter Notes', 'cpt-plugin' ); ?></h3>
471
- <div><ol>
472
- <?php
473
- echo '<li>' . sprintf( __( 'Taxonomy names should have %smax 32 characters%s, and only contain alphanumeric, lowercase, characters, underscores in place of spaces, and letters that do not have accents.', 'cpt-plugin' ), '<strong class="wp-ui-highlight">', '</strong>' );
474
- echo '<li>' . sprintf( __( 'If you are unfamiliar with the advanced taxonomy settings, just fill in the %sTaxonomy Name%s and choose an %sAttach to Post Type%s option. Remaining settings will use default values. Labels, if left blank, will be automatically created based on the taxonomy name. Hover over the question marks for more details.', 'cpt-plugin' ), '<strong class="wp-ui-highlight">', '</strong>', '<strong class="wp-ui-highlight">', '</strong>' ) ;
475
- echo '<li>' . sprintf( __( 'Deleting custom taxonomies do %sNOT%s delete terms added to those taxonomies. You can recreate your taxonomies and the terms will return. Changing the name, after adding terms to the taxonomy, will not update the terms in the database.', 'cpt-plugin' ), '<strong class="wp-ui-highlight">', '</strong>' ); ?>
476
- </ol></div>
477
- <?php } ?>
478
  </div>
479
  </td>
480
  </tr>
@@ -501,8 +504,6 @@ function cptui_taxonomies_dropdown( $taxonomies = array() ) {
501
  $select = array();
502
  $select['options'] = array();
503
 
504
- $select['options'][] = array( 'attr' => '', 'text' => '--' );
505
-
506
  foreach( $taxonomies as $tax ) {
507
  $select['options'][] = array( 'attr' => $tax['name'], 'text' => $tax['label'] );
508
  }
@@ -534,6 +535,14 @@ function cptui_get_current_taxonomy() {
534
  if ( isset( $_POST['cpt_custom_tax']['name'] ) ) {
535
  return sanitize_text_field( $_POST['cpt_custom_tax']['name'] );
536
  }
 
 
 
 
 
 
 
 
537
  }
538
 
539
  return false;
@@ -647,26 +656,29 @@ function cptui_update_taxonomy( $data = array() ) {
647
  }
648
  $label = str_replace( '"', '', htmlspecialchars_decode( $label ) );
649
  $label = htmlspecialchars( $label, ENT_QUOTES );
650
-
651
  $data['cpt_tax_labels'][ $key ] = stripslashes_deep( $label );
652
  }
653
 
654
  $label = str_replace( '"', '', htmlspecialchars_decode( $data['cpt_custom_tax']['label'] ) );
655
  $label = htmlspecialchars( stripslashes( $label ), ENT_QUOTES );
656
 
 
657
  $singular_label = str_replace( '"', '', htmlspecialchars_decode( $data['cpt_custom_tax']['singular_label'] ) );
658
  $singular_label = htmlspecialchars( stripslashes( $singular_label ) );
 
 
659
 
660
  $taxonomies[ $data['cpt_custom_tax']['name'] ] = array(
661
- 'name' => $data['cpt_custom_tax']['name'],
662
  'label' => $label,
663
  'singular_label' => $singular_label,
664
  'hierarchical' => disp_boolean( $data['cpt_custom_tax']['hierarchical'] ),
665
  'show_ui' => disp_boolean( $data['cpt_custom_tax']['show_ui'] ),
666
  'query_var' => disp_boolean( $data['cpt_custom_tax']['query_var'] ),
667
- 'query_var_slug' => $data['cpt_custom_tax']['query_var_slug'],
668
  'rewrite' => disp_boolean( $data['cpt_custom_tax']['rewrite'] ),
669
- 'rewrite_slug' => $data['cpt_custom_tax']['rewrite_slug'],
670
  'rewrite_withfront' => $data['cpt_custom_tax']['rewrite_withfront'],
671
  'rewrite_hierarchical' => $data['cpt_custom_tax']['rewrite_hierarchical'],
672
  'show_admin_column' => disp_boolean( $data['cpt_custom_tax']['show_admin_column'] ),
@@ -696,3 +708,10 @@ function cptui_update_taxonomy( $data = array() ) {
696
 
697
  return cptui_admin_notices( 'update', $data['cpt_custom_tax']['name'], true );
698
  }
 
 
 
 
 
 
 
20
  }
21
 
22
  wp_enqueue_script( 'cptui', plugins_url( 'js/cptui.js' , dirname(__FILE__) ) . '', array( 'jquery', 'jquery-ui-core', 'jquery-ui-accordion' ), CPT_VERSION, true );
23
+ wp_localize_script( 'cptui', 'cptui_tax_data',
24
+ array(
25
+ 'confirm' => __( 'Are you sure you want to delete this?', 'cpt-plugin' ),
26
+ #'tax_change_name' => '<div class="typetax-rename">' . __( 'Changing this will rename the taxonomy.', 'cpt-plugin' ) . '</div>'
27
+ )
28
+ );
29
  }
30
  add_action( 'admin_enqueue_scripts', 'cptui_taxonomies_enqueue_scripts' );
31
 
 
 
 
 
 
 
 
 
 
 
32
  /**
33
  * Create our settings page output.
34
  *
79
  # Will only be set if we're already on the edit screen
80
  if ( !empty( $taxonomies ) ) { ?>
81
  <form id="cptui_select_taxonomy" method="post">
82
+ <p><?php _e( 'DO NOT EDIT the taxonomy slug unless necessary. Changing that value registers a new taxonomy entry for your install.', 'cpt-plugin' ); ?></p>
83
  <?php
84
+ _e( 'Select: ', 'cpt-plugin' );
85
  cptui_taxonomies_dropdown( $taxonomies );
86
  ?>
 
87
  </form>
88
  <?php
89
+
90
+ /**
91
+ * Fires below the taxonomy select input.
92
+ *
93
+ * @since 1.1.0
94
+ *
95
+ * @param string $value Current taxonomy selected.
96
+ */
97
+ do_action( 'cptui_below_taxonomy_select', $current['name'] );
98
  } ?>
99
 
100
  <form method="post">
101
  <table class="form-table cptui-table">
102
  <tr>
103
+ <td class="outter">
104
  <table>
105
  <?php
106
 
111
  'maxlength' => '32',
112
  'onblur' => 'this.value=this.value.toLowerCase()',
113
  'labeltext' => __( 'Taxonomy Slug', 'cpt-plugin' ),
114
+ 'aftertext' => __( '(e.g. actor)', 'cpt-plugin' ),
115
  'helptext' => esc_attr__( 'The taxonomy name. Used to retrieve custom taxonomy content. Should be short and unique', 'cpt-plugin'),
116
  'required' => true,
117
  ) );
173
  <p class="submit">
174
  <?php wp_nonce_field( 'cptui_addedit_taxonomy_nonce_action', 'cptui_addedit_taxonomy_nonce_field' );
175
  if ( !empty( $_GET ) && !empty( $_GET['action'] ) && 'edit' == $_GET['action'] ) { ?>
176
+ <input type="submit" class="button-primary" name="cpt_submit" value="<?php echo esc_attr( apply_filters( 'cptui_taxonomy_submit_edit', __( 'Save Taxonomy', 'cpt-plugin' ) ) ); ?>" />
177
  <input type="submit" class="button-secondary" name="cpt_delete" id="cpt_submit_delete" value="<?php echo apply_filters( 'cptui_taxonomy_submit_delete', __( 'Delete Taxonomy', 'cpt-plugin' ) ); ?>" />
178
  <?php } else { ?>
179
  <input type="submit" class="button-primary" name="cpt_submit" value="<?php echo esc_attr( apply_filters( 'cptui_taxonomy_submit_add', __( 'Add Taxonomy', 'cpt-plugin' ) ) ); ?>" />
180
  <?php } ?>
181
  <input type="hidden" name="cpt_tax_status" id="cpt_tax_status" value="<?php echo $tab; ?>" />
182
  </p>
 
 
 
183
 
184
+ <?php if ( 'new' == $tab ) { ?>
185
+ <h3><?php _e( 'Starter Notes', 'cpt-plugin' ); ?></h3>
186
+ <div><ol>
187
+ <?php
188
+ echo '<li>' . sprintf( __( 'Taxonomy names should have %smax 32 characters%s, and only contain alphanumeric, lowercase, characters, underscores in place of spaces, and letters that do not have accents.', 'cpt-plugin' ), '<strong class="wp-ui-highlight">', '</strong>' );
189
+ echo '<li>' . sprintf( __( 'If you are unfamiliar with the advanced taxonomy settings, just fill in the %sTaxonomy Name%s and choose an %sAttach to Post Type%s option. Remaining settings will use default values. Labels, if left blank, will be automatically created based on the taxonomy name. Hover over the question marks for more details.', 'cpt-plugin' ), '<strong class="wp-ui-highlight">', '</strong>', '<strong class="wp-ui-highlight">', '</strong>' ) ;
190
+ echo '<li>' . sprintf( __( 'Deleting custom taxonomies do %sNOT%s delete terms added to those taxonomies. You can recreate your taxonomies and the terms will return. Changing the name, after adding terms to the taxonomy, will not update the terms in the database.', 'cpt-plugin' ), '<strong class="wp-ui-highlight">', '</strong>' ); ?>
191
+ </ol></div>
192
+ <?php } ?>
193
+ </td>
194
+ <td class="outter">
195
+ <div>
196
+ <h3><?php _e( 'Labels', 'cpt-plugin' ); ?></h3>
197
  <div>
198
  <table>
199
  <?php
335
  ?>
336
  </table>
337
  </div>
338
+ <h3><?php _e( 'Settings', 'cpt-plugin' ); ?></h3>
339
  <div>
340
  <table>
341
  <?php
369
  'name' => 'show_ui',
370
  'labeltext' => __( 'Show UI', 'cpt-plugin' ),
371
  'aftertext' => __( '(default: True)', 'cpt-plugin' ),
372
+ 'helptext' => esc_attr__( 'Whether to generate a default UI for managing this custom taxonomy.', 'cpt-plugin' ),
373
  'selections' => $select
374
  ) );
375
 
386
  'name' => 'query_var',
387
  'labeltext' => __( 'Query Var', 'cpt-plugin' ),
388
  'aftertext' => __( '(default: True)', 'cpt-plugin' ),
389
+ 'helptext' => esc_attr__( 'Sets the query_var key for this taxonomy.', 'cpt-plugin' ),
390
  'selections' => $select
391
  ) );
392
 
396
  'textvalue' => ( isset( $current['query_var_slug'] ) ) ? esc_attr( $current['query_var_slug'] ) : '',
397
  'aftertext' => __( '(default: none). Query Var needs to be true to use.', 'cpt-plugin' ),
398
  'labeltext' => __( 'Custom Query Var String', 'cpt-plugin' ),
399
+ 'helptext' => esc_attr__( 'Sets a custom query_var slug for this taxonomy.', 'cpt-plugin'),
400
  ) );
401
 
402
  $select = array(
412
  'name' => 'rewrite',
413
  'labeltext' => __( 'Rewrite', 'cpt-plugin' ),
414
  'aftertext' => __( '(default: True)', 'cpt-plugin' ),
415
+ 'helptext' => esc_attr__( 'Whether or not WordPress should use rewrites for this taxonomy.', 'cpt-plugin' ),
416
  'selections' => $select
417
  ) );
418
 
422
  'textvalue' => ( isset( $current['rewrite_slug'] ) ) ? esc_attr( $current['rewrite_slug'] ) : '',
423
  'aftertext' => __( '(default: taxonomy name)', 'cpt-plugin' ),
424
  'labeltext' => __( 'Custom Rewrite Slug', 'cpt-plugin' ),
425
+ 'helptext' => esc_attr__( 'Custom taxonomy rewrite slug.', 'cpt-plugin'),
426
  ) );
427
 
428
  $select = array(
478
  ?>
479
  </table>
480
  </div>
 
 
 
 
 
 
 
 
 
 
481
  </div>
482
  </td>
483
  </tr>
504
  $select = array();
505
  $select['options'] = array();
506
 
 
 
507
  foreach( $taxonomies as $tax ) {
508
  $select['options'][] = array( 'attr' => $tax['name'], 'text' => $tax['label'] );
509
  }
535
  if ( isset( $_POST['cpt_custom_tax']['name'] ) ) {
536
  return sanitize_text_field( $_POST['cpt_custom_tax']['name'] );
537
  }
538
+ } else if ( !empty( $_GET ) && isset( $_GET['cptui_taxonomy'] ) ) {
539
+ return sanitize_text_field( $_GET['cptui_taxonomy'] );
540
+ } else {
541
+ $taxonomies = get_option( 'cptui_taxonomies' );
542
+ if ( !empty( $taxonomies ) ) {
543
+ # Will return the first array key
544
+ return key( $taxonomies );
545
+ }
546
  }
547
 
548
  return false;
656
  }
657
  $label = str_replace( '"', '', htmlspecialchars_decode( $label ) );
658
  $label = htmlspecialchars( $label, ENT_QUOTES );
659
+ $label = trim( $label );
660
  $data['cpt_tax_labels'][ $key ] = stripslashes_deep( $label );
661
  }
662
 
663
  $label = str_replace( '"', '', htmlspecialchars_decode( $data['cpt_custom_tax']['label'] ) );
664
  $label = htmlspecialchars( stripslashes( $label ), ENT_QUOTES );
665
 
666
+ $name = trim( $data['cpt_custom_tax']['name'] );
667
  $singular_label = str_replace( '"', '', htmlspecialchars_decode( $data['cpt_custom_tax']['singular_label'] ) );
668
  $singular_label = htmlspecialchars( stripslashes( $singular_label ) );
669
+ $query_var_slug = trim( $data['cpt_custom_tax']['query_var_slug'] );
670
+ $rewrite_slug = trim( $data['cpt_custom_tax']['rewrite_slug'] );
671
 
672
  $taxonomies[ $data['cpt_custom_tax']['name'] ] = array(
673
+ 'name' => $name,
674
  'label' => $label,
675
  'singular_label' => $singular_label,
676
  'hierarchical' => disp_boolean( $data['cpt_custom_tax']['hierarchical'] ),
677
  'show_ui' => disp_boolean( $data['cpt_custom_tax']['show_ui'] ),
678
  'query_var' => disp_boolean( $data['cpt_custom_tax']['query_var'] ),
679
+ 'query_var_slug' => $query_var_slug,
680
  'rewrite' => disp_boolean( $data['cpt_custom_tax']['rewrite'] ),
681
+ 'rewrite_slug' => $rewrite_slug,
682
  'rewrite_withfront' => $data['cpt_custom_tax']['rewrite_withfront'],
683
  'rewrite_hierarchical' => $data['cpt_custom_tax']['rewrite_hierarchical'],
684
  'show_admin_column' => disp_boolean( $data['cpt_custom_tax']['show_admin_column'] ),
708
 
709
  return cptui_admin_notices( 'update', $data['cpt_custom_tax']['name'], true );
710
  }
711
+
712
+ /**
713
+ * Convert taxonomies.
714
+ * @param string $original_slug
715
+ * @param string $new_slug
716
+ */
717
+ function cptui_convert_taxonomy_terms( $original_slug = '', $new_slug = '' ) {}
js/cptui.js CHANGED
@@ -1,15 +1,22 @@
1
  (function($) {
2
- //Create our accordions
3
- $( "#cptui_accordion" ).accordion({ collapsible: true, heightStyle: 'fill', active: 2 });
 
 
 
 
 
 
4
 
5
  //confirm our deletions
6
  $( '#cpt_submit_delete' ).on( 'click', function() {
7
- if( confirm( confirmdata.confirm ) ) {
8
  return true;
9
  }
10
  return false;
11
  });
12
 
 
13
  $('#support .question').each(function() {
14
  var tis = $(this), state = false, answer = tis.next('div').slideUp();
15
  tis.click(function() {
@@ -19,14 +26,29 @@
19
  });
20
  });
21
 
22
- var orig, highlight;
23
- $('#cptui_accordion h3').hover(function(){
24
- orig = $(this).css('color');
25
- highlight = $('.wp-ui-highlight').css('background-color');
26
- $(this).css({'color':highlight});
27
- }, function() {
28
- $(this).css({'color':orig });
 
 
 
29
  }
30
- );
31
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  })(jQuery);
1
  (function($) {
2
+
3
+ $( '#post_type' ).on( 'change', function(){
4
+ $('#cptui_select_post_type').submit();
5
+ });
6
+
7
+ $( '#taxonomy' ).on( 'change', function(){
8
+ $( '#cptui_select_taxonomy' ).submit();
9
+ });
10
 
11
  //confirm our deletions
12
  $( '#cpt_submit_delete' ).on( 'click', function() {
13
+ if( confirm( cptui_type_data.confirm ) ) {
14
  return true;
15
  }
16
  return false;
17
  });
18
 
19
+ //Toggles help/support accordions.
20
  $('#support .question').each(function() {
21
  var tis = $(this), state = false, answer = tis.next('div').slideUp();
22
  tis.click(function() {
26
  });
27
  });
28
 
29
+ //Handles message display for slug changes.
30
+ /*if ( 'cpt-ui_page_cptui_manage_post_types' === window.adminpage ) {
31
+ $('#name').after(cptui_type_data.post_change_name);
32
+ } else if ( 'cpt-ui_page_cptui_manage_taxonomies' === window.adminpage ) {
33
+ $('#name').after(cptui_tax_data.tax_change_name);
34
+ }
35
+ $( '#name' ).on( 'keyup', function( e ) {
36
+ //return early on this for now.
37
+ if ( 'cpt-ui_page_cptui_manage_taxonomies' === window.adminpage ) {
38
+ return;
39
  }
40
+ var $input = $('.typetax-rename');
41
 
42
+ if ( 0 === $(this).val().length ) {
43
+ $input.addClass('cptui-hidden');
44
+ }
45
+
46
+ if ( -1 === $.inArray( $(this).val(), cptui_type_data.post_types ) || -1 === $.inArray( $(this).val(), cptui_tax_data.taxonomies ) ) {
47
+ if ( $input.hasClass( 'cptui-hidden' ) ) {
48
+ $input.removeClass('cptui-hidden');
49
+ }
50
+ } else {
51
+ $input.addClass('cptui-hidden');
52
+ }
53
+ });*/
54
  })(jQuery);
languages/cpt-plugin-de_DE.mo CHANGED
Binary file
languages/cpt-plugin-de_DE.po CHANGED
@@ -1,35 +1,65 @@
1
  msgid ""
2
  msgstr ""
3
- "Project-Id-Version: Custom Post Type UI 1.0.6\n"
4
- "POT-Creation-Date: 2015-04-10 11:48-0600\n"
5
- "PO-Revision-Date: 2015-04-10 11:48-0600\n"
6
- "Last-Translator: Michael Beckwith <michael.d.beckwith@gmail.com>\n"
7
  "Language-Team: Pascal Kläres & Ralf Koller <pascal.klaeres@gmail.com & r."
8
  "koller@gmail.com>\n"
9
  "Language: de_DE\n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
12
  "Content-Transfer-Encoding: 8bit\n"
13
- "X-Generator: Poedit 1.7.5\n"
14
  "X-Poedit-KeywordsList: __;_e;esc_attr__;esc_attr_e;esc_attr_x;_n;_x;_ex;_nx;"
15
  "esc_html__;esc_html_e;esc_html_x\n"
16
- "X-Poedit-Basepath: .\n"
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
- "X-Poedit-SearchPath-0: ..\n"
 
19
 
20
- #: ../custom-post-type-ui.php:58
21
  msgid "Custom Post Types"
22
  msgstr "Custom Post Types"
23
 
24
- #: ../custom-post-type-ui.php:58
25
  msgid "CPT UI"
26
  msgstr "CPT UI"
27
 
28
- #: ../custom-post-type-ui.php:320 ../custom-post-type-ui.php:410
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  msgid "Custom Post Type UI"
30
  msgstr "Custom Post Type UI"
31
 
32
- #: ../custom-post-type-ui.php:323
33
  msgid ""
34
  "Thank you for choosing Custom Post Type UI. We hope that your experience "
35
  "with our plugin provides efficiency and speed in creating post types and "
@@ -40,45 +70,59 @@ msgstr ""
40
  "Post Types und Taxonomien erstellen kannst sowie Ihre Inhalte besser "
41
  "organisieren, ohne dabei eine Zeile Code schreiben zu müssen."
42
 
43
- #: ../custom-post-type-ui.php:325
44
- #, php-format
45
- msgid ""
46
- "To get started with creating some post types, please visit %s and for "
47
- "taxonomies, visit %s. If you need some help, check the %s page. If nothing "
48
- "there fits your issue, visit our %s and we will try to get to your question "
49
- "as soon as possible."
50
- msgstr ""
51
- "Um Custom Post Types UI näher kennenzulernen erstelle doch unter %s einige "
52
- "Post Types; Taxonomien kannst Du unter %s erstellen. Falls Du Hilfe "
53
- "benötigst, gehe bitte auf die %s Seite. Sollte keiner der angeführten "
54
- "Lösungsansätze bei deinem Problem behilflich sein, besuche unser %s und wir "
55
- "werden uns Deiner Frage so schnell wie möglich annehmen."
56
-
57
- #: ../custom-post-type-ui.php:326 ../inc/post-types.php:33
58
- msgid "Add/Edit Post Types"
59
- msgstr "Post Types hinzufügen/editieren"
60
 
61
- #: ../custom-post-type-ui.php:327 ../inc/taxonomies.php:33
62
- msgid "Add/Edit Taxonomies"
63
- msgstr "Taxonomien hinzufügen/editieren"