| 1 |
<?php |
| 2 |
|
| 3 |
class SimpleTags_Admin_Taxonomies |
| 4 |
{ |
| 5 |
|
| 6 |
const MENU_SLUG = 'st_options'; |
| 7 |
|
| 8 |
// class instance |
| 9 |
static $instance; |
| 10 |
|
| 11 |
// WP_List_Table object |
| 12 |
public $terms_table; |
| 13 |
|
| 14 |
/** |
| 15 |
* Constructor |
| 16 |
* |
| 17 |
* @return void |
| 18 |
* @author Olatechpro |
| 19 |
*/ |
| 20 |
public function __construct() |
| 21 |
{ |
| 22 |
|
| 23 |
add_filter('set-screen-option', [__CLASS__, 'set_screen'], 10, 3); |
| 24 |
// Admin menu |
| 25 |
add_action('admin_menu', [$this, 'admin_menu']); |
| 26 |
|
| 27 |
// Javascript |
| 28 |
add_action('admin_enqueue_scripts', [__CLASS__, 'admin_enqueue_scripts'], 11); |
| 29 |
|
| 30 |
} |
| 31 |
|
| 32 |
/** |
| 33 |
* Init somes JS and CSS need for this feature |
| 34 |
* |
| 35 |
* @return void |
| 36 |
* @author Olatechpro |
| 37 |
*/ |
| 38 |
public static function admin_enqueue_scripts() |
| 39 |
{ |
| 40 |
wp_register_script('st-taxonomies', STAGS_URL . '/assets/js/taxonomies.js', |
| 41 |
['jquery', 'jquery-ui-dialog', 'postbox'], STAGS_VERSION); |
| 42 |
wp_register_style('st-taxonomies-css', STAGS_URL . '/assets/css/taxonomies.css', ['wp-jquery-ui-dialog'], |
| 43 |
STAGS_VERSION, 'all'); |
| 44 |
|
| 45 |
// add JS for manage click tags |
| 46 |
if (isset($_GET['page']) && $_GET['page'] == 'st_taxonomies') { |
| 47 |
wp_enqueue_script('st-taxonomies'); |
| 48 |
wp_enqueue_style('st-taxonomies-css'); |
| 49 |
|
| 50 |
|
| 51 |
$core = get_taxonomies(['_builtin' => true]); |
| 52 |
$public = get_taxonomies([ |
| 53 |
'_builtin' => false, |
| 54 |
'public' => true, |
| 55 |
]); |
| 56 |
$private = get_taxonomies([ |
| 57 |
'_builtin' => false, |
| 58 |
'public' => false, |
| 59 |
]); |
| 60 |
$registered_taxonomies = array_merge($core, $public, $private); |
| 61 |
wp_localize_script('st-taxonomies', 'taxopress_tax_data', |
| 62 |
[ |
| 63 |
'confirm' => esc_html__('Are you sure you want to delete this? Deleting will NOT remove created content.', |
| 64 |
'simple-tags'), |
| 65 |
'no_associated_type' => esc_html__('Please select at least one post type.', 'simple-tags'), |
| 66 |
'existing_taxonomies' => $registered_taxonomies, |
| 67 |
'integer_error' => esc_html__('Taxonomy slug cannot be numbers only.', 'simple-tags'), |
| 68 |
] |
| 69 |
); |
| 70 |
|
| 71 |
} |
| 72 |
} |
| 73 |
|
| 74 |
public static function set_screen($status, $option, $value) |
| 75 |
{ |
| 76 |
return $value; |
| 77 |
} |
| 78 |
|
| 79 |
/** Singleton instance */ |
| 80 |
public static function get_instance() |
| 81 |
{ |
| 82 |
if (!isset(self::$instance)) { |
| 83 |
self::$instance = new self(); |
| 84 |
} |
| 85 |
|
| 86 |
return self::$instance; |
| 87 |
} |
| 88 |
|
| 89 |
/** |
| 90 |
* Add WP admin menu for Tags |
| 91 |
* |
| 92 |
* @return void |
| 93 |
* @author Olatechpro |
| 94 |
*/ |
| 95 |
public function admin_menu() |
| 96 |
{ |
| 97 |
$hook = add_submenu_page( |
| 98 |
self::MENU_SLUG, |
| 99 |
__('Taxonomies', 'simple-tags'), |
| 100 |
__('Taxonomies', 'simple-tags'), |
| 101 |
'simple_tags', |
| 102 |
'st_taxonomies', |
| 103 |
[ |
| 104 |
$this, |
| 105 |
'page_manage_taxonomies', |
| 106 |
] |
| 107 |
); |
| 108 |
|
| 109 |
if(taxopress_is_screen_main_page()){ |
| 110 |
add_action("load-$hook", [$this, 'screen_option']); |
| 111 |
} |
| 112 |
} |
| 113 |
|
| 114 |
/** |
| 115 |
* Screen options |
| 116 |
*/ |
| 117 |
public function screen_option() |
| 118 |
{ |
| 119 |
|
| 120 |
$option = 'per_page'; |
| 121 |
$args = [ |
| 122 |
'label' => __('Number of items per page', 'simple-tags'), |
| 123 |
'default' => 20, |
| 124 |
'option' => 'st_taxonomies_per_page' |
| 125 |
]; |
| 126 |
|
| 127 |
add_screen_option($option, $args); |
| 128 |
|
| 129 |
$this->terms_table = new Taxonomy_List(); |
| 130 |
} |
| 131 |
|
| 132 |
/** |
| 133 |
* Method for build the page HTML manage tags |
| 134 |
* |
| 135 |
* @return void |
| 136 |
* @author Olatechpro |
| 137 |
*/ |
| 138 |
public function page_manage_taxonomies() |
| 139 |
{ |
| 140 |
// Default order |
| 141 |
if (!isset($_GET['order'])) { |
| 142 |
$_GET['order'] = 'name-asc'; |
| 143 |
} |
| 144 |
|
| 145 |
settings_errors(__CLASS__); |
| 146 |
|
| 147 |
if (!isset($_GET['add'])) { |
| 148 |
//all tax |
| 149 |
?> |
| 150 |
<div class="wrap st_wrap st-manage-taxonomies-page"> |
| 151 |
|
| 152 |
<div id=""> |
| 153 |
<h1 class="wp-heading-inline"><?php _e('Taxonomies', 'simple-tags'); ?></h1> |
| 154 |
<a href="<?php echo esc_url(admin_url('admin.php?page=st_taxonomies&add=taxonomy')); ?>" |
| 155 |
class="page-title-action"><?php esc_html_e('Add New', 'simple-tags'); ?></a> |
| 156 |
|
| 157 |
<div class="taxopress-description">This feature allows you to create new taxonomies and edit all the settings for each taxonomy.</div> |
| 158 |
|
| 159 |
|
| 160 |
<?php |
| 161 |
if (isset($_REQUEST['s']) && $search = esc_attr(wp_unslash($_REQUEST['s']))) { |
| 162 |
/* translators: %s: search keywords */ |
| 163 |
printf(' <span class="subtitle">' . __('Search results for “%s”', |
| 164 |
'simple-tags') . '</span>', $search); |
| 165 |
} |
| 166 |
?> |
| 167 |
<?php |
| 168 |
|
| 169 |
//the terms table instance |
| 170 |
$this->terms_table->prepare_items(); |
| 171 |
?> |
| 172 |
|
| 173 |
|
| 174 |
<hr class="wp-header-end"> |
| 175 |
<div id="ajax-response"></div> |
| 176 |
<form class="search-form wp-clearfix st-taxonomies-search-form" method="get"> |
| 177 |
<?php $this->terms_table->search_box(__('Search Taxonomies', 'simple-tags'), 'term'); ?> |
| 178 |
</form> |
| 179 |
<div class="clear"></div> |
| 180 |
|
| 181 |
<div id="col-container" class="wp-clearfix"> |
| 182 |
|
| 183 |
<div class="col-wrap"> |
| 184 |
<?php |
| 185 |
$selected_option = 'public'; |
| 186 |
if ( isset($_GET['taxonomy_type']) && $_GET['taxonomy_type'] === 'all' ) { |
| 187 |
$selected_option = 'all'; |
| 188 |
}elseif ( isset($_GET['taxonomy_type']) && $_GET['taxonomy_type'] === 'private' ) { |
| 189 |
$selected_option = 'private'; |
| 190 |
} |
| 191 |
?> |
| 192 |
<div class="taxopress-taxonomy-type-wrap"> |
| 193 |
<select name="taxopress-taxonomy-type" class="taxopress-taxonomy-type"> |
| 194 |
<option value="all" <?php echo ($selected_option === 'all' ? 'selected="selected"' : ''); ?>><?php echo __('All Taxonomies', 'simple-tags'); ?></option> |
| 195 |
<option value="public" <?php echo ($selected_option === 'public' ? 'selected="selected"' : ''); ?>><?php echo __('Public Taxonomies', 'simple-tags'); ?></option> |
| 196 |
<option value="private" <?php echo ($selected_option === 'private' ? 'selected="selected"' : ''); ?>><?php echo __('Private Taxonomies', 'simple-tags'); ?></option> |
| 197 |
</select> |
| 198 |
</div> |
| 199 |
<form action="<?php echo add_query_arg('', '') ?>" method="post"> |
| 200 |
<?php $this->terms_table->display(); //Display the table ?> |
| 201 |
</form> |
| 202 |
<div class="form-wrap edit-term-notes"> |
| 203 |
<p><?php __('Description here.', 'simple-tags') ?></p> |
| 204 |
</div> |
| 205 |
</div> |
| 206 |
|
| 207 |
|
| 208 |
</div> |
| 209 |
|
| 210 |
|
| 211 |
</div> |
| 212 |
<?php } else { |
| 213 |
if ($_GET['add'] == 'taxonomy') { |
| 214 |
//add/edit taxonomy |
| 215 |
$this->taxopress_manage_taxonomies(); |
| 216 |
echo '<div>'; |
| 217 |
} |
| 218 |
} ?> |
| 219 |
|
| 220 |
|
| 221 |
<?php SimpleTags_Admin::printAdminFooter(); ?> |
| 222 |
</div> |
| 223 |
<?php |
| 224 |
do_action('simpletags-taxonomies', SimpleTags_Admin::$taxonomy); |
| 225 |
} |
| 226 |
|
| 227 |
|
| 228 |
/** |
| 229 |
* Create our settings page output. |
| 230 |
* |
| 231 |
* @internal |
| 232 |
*/ |
| 233 |
public function taxopress_manage_taxonomies() |
| 234 |
{ |
| 235 |
|
| 236 |
$tab = (!empty($_GET) && !empty($_GET['action']) && 'edit' == $_GET['action']) ? 'edit' : 'new'; |
| 237 |
$tab_class = 'taxopress-' . $tab; |
| 238 |
$current = null; |
| 239 |
|
| 240 |
?> |
| 241 |
|
| 242 |
<div class="wrap <?php echo esc_attr($tab_class); ?>"> |
| 243 |
|
| 244 |
<?php |
| 245 |
/** |
| 246 |
* Fires right inside the wrap div for the taxonomy editor screen. |
| 247 |
*/ |
| 248 |
do_action('taxopress_inside_taxonomy_wrap'); |
| 249 |
|
| 250 |
/** |
| 251 |
* Filters whether or not a taxonomy was deleted. |
| 252 |
* |
| 253 |
* @param bool $value Whether or not taxonomy deleted. Default false. |
| 254 |
*/ |
| 255 |
$taxonomy_deleted = apply_filters('taxopress_taxonomy_deleted', false); |
| 256 |
|
| 257 |
/** |
| 258 |
* Fires below the output for the tab menu on the taxonomy add/edit screen. |
| 259 |
*/ |
| 260 |
do_action('taxopress_below_taxonomy_tab_menu'); |
| 261 |
|
| 262 |
$external_edit = false; |
| 263 |
$taxonomy_edit = false; |
| 264 |
$core_edit = false; |
| 265 |
|
| 266 |
if ('edit' === $tab) { |
| 267 |
|
| 268 |
$taxonomies = taxopress_get_taxonomy_data(); |
| 269 |
|
| 270 |
$selected_taxonomy = taxopress_get_current_taxonomy($taxonomy_deleted); |
| 271 |
$request_tax = sanitize_text_field($_GET['taxopress_taxonomy']); |
| 272 |
|
| 273 |
if ($selected_taxonomy && array_key_exists($selected_taxonomy, $taxonomies)) { |
| 274 |
$current = $taxonomies[$selected_taxonomy]; |
| 275 |
$taxonomy_edit = true; |
| 276 |
} elseif (taxonomy_exists($request_tax)) { |
| 277 |
//not out taxonomy |
| 278 |
$external_taxonomy = get_taxonomies(['name' => $request_tax], 'objects'); |
| 279 |
if (isset($external_taxonomy) > 0) { |
| 280 |
$current = taxopress_convert_external_taxonomy($external_taxonomy[$request_tax], |
| 281 |
$request_tax); |
| 282 |
$external_edit = true; |
| 283 |
$taxonomy_edit = true; |
| 284 |
} |
| 285 |
} |
| 286 |
|
| 287 |
if($request_tax === 'media_tag'){ |
| 288 |
$external_edit = false; |
| 289 |
} |
| 290 |
} |
| 291 |
|
| 292 |
if($taxonomy_edit){ |
| 293 |
$wordpress_core_tax = array_keys(get_taxonomies(['_builtin' => true])); |
| 294 |
$wordpress_core_tax[] = 'post_tag'; |
| 295 |
$wordpress_core_tax[] = 'category'; |
| 296 |
if(in_array($current['name'], $wordpress_core_tax)){ |
| 297 |
$core_edit = true; |
| 298 |
} |
| 299 |
} |
| 300 |
|
| 301 |
$ui = new taxopress_admin_ui(); |
| 302 |
?> |
| 303 |
|
| 304 |
|
| 305 |
<div class="wrap <?php echo esc_attr($tab_class); ?>"> |
| 306 |
<h1><?php echo __('Manage Taxonomy', 'simple-tags'); ?></h1> |
| 307 |
<div class="wp-clearfix"></div> |
| 308 |
|
| 309 |
<form method="post" action="<?php echo esc_url(taxopress_get_post_form_action($ui)); ?>"> |
| 310 |
|
| 311 |
<div class="taxopress-right-sidebar"> |
| 312 |
<div class="taxopress-right-sidebar-wrapper"> |
| 313 |
|
| 314 |
<?php |
| 315 |
if($taxonomy_edit){ |
| 316 |
if ($core_edit) { |
| 317 |
echo '<div class="taxopress-warning">' . __('This taxonomy is part of the WordPress core.', |
| 318 |
'simple-tags') . ' |
| 319 |
|
| 320 |
<br /><br /> |
| 321 |
' . __('Registration key', |
| 322 |
'simple-tags') . ': <font color="green">' . $current["name"] . '</font> |
| 323 |
|
| 324 |
</div>'; |
| 325 |
}elseif ($external_edit) { |
| 326 |
echo '<div class="taxopress-warning">' . __('This is an external taxonomy and not created with TaxoPress.', |
| 327 |
'simple-tags') . ' |
| 328 |
|
| 329 |
<br /><br /> |
| 330 |
' . __('Registration key', |
| 331 |
'simple-tags') . ': <font color="green">' . $current["name"] . '</font> |
| 332 |
|
| 333 |
</div>'; |
| 334 |
}else{ |
| 335 |
echo '<div class="taxopress-warning">' . __('This taxonomy was created by TaxoPress.', |
| 336 |
'simple-tags') . ' |
| 337 |
|
| 338 |
<br /><br /> |
| 339 |
' . __('Registration key', |
| 340 |
'simple-tags') . ': <font color="green">' . $current["name"] . '</font> |
| 341 |
|
| 342 |
</div>'; |
| 343 |
} |
| 344 |
} |
| 345 |
?> |
| 346 |
|
| 347 |
<p class="submit"> |
| 348 |
|
| 349 |
<?php |
| 350 |
wp_nonce_field('taxopress_addedit_taxonomy_nonce_action', |
| 351 |
'taxopress_addedit_taxonomy_nonce_field'); |
| 352 |
if (!empty($_GET) && !empty($_GET['action']) && 'edit' === $_GET['action']) { ?> |
| 353 |
<?php |
| 354 |
|
| 355 |
/** |
| 356 |
* Filters the text value to use on the button when editing. |
| 357 |
* |
| 358 |
* @param string $value Text to use for the button. |
| 359 |
*/ |
| 360 |
?> |
| 361 |
<input type="submit" class="button-primary taxopress-taxonomy-submit" name="cpt_submit" |
| 362 |
value="<?php echo esc_attr(apply_filters('taxopress_taxonomy_submit_edit', |
| 363 |
esc_attr__('Save Taxonomy', 'simple-tags'))); ?>"/> |
| 364 |
<?php |
| 365 |
} else { ?> |
| 366 |
<?php |
| 367 |
|
| 368 |
/** |
| 369 |
* Filters the text value to use on the button when adding. |
| 370 |
* |
| 371 |
* @param string $value Text to use for the button. |
| 372 |
*/ |
| 373 |
?> |
| 374 |
<input type="submit" class="button-primary taxopress-taxonomy-submit" name="cpt_submit" |
| 375 |
value="<?php echo esc_attr(apply_filters('taxopress_taxonomy_submit_add', |
| 376 |
esc_attr__('Add Taxonomy', 'simple-tags'))); ?>"/> |
| 377 |
<?php } ?> |
| 378 |
<div class="taxonomy-required-field"></div> |
| 379 |
|
| 380 |
<?php if (!empty($current)) { ?> |
| 381 |
<input type="hidden" name="tax_original" id="tax_original" |
| 382 |
value="<?php echo esc_attr($current['name']); ?>"/> |
| 383 |
<?php |
| 384 |
} |
| 385 |
|
| 386 |
// Used to check and see if we should prevent duplicate slugs. |
| 387 |
?> |
| 388 |
<input type="hidden" name="cpt_tax_status" id="cpt_tax_status" |
| 389 |
value="<?php echo esc_attr($tab); ?>"/> |
| 390 |
</p> |
| 391 |
|
| 392 |
|
| 393 |
</div> |
| 394 |
|
| 395 |
</div> |
| 396 |
|
| 397 |
<?php |
| 398 |
if ($external_edit) { |
| 399 |
echo '<input type="hidden" name="taxonomy_external_edit" class="taxonomy_external_edit" value="1" />'; |
| 400 |
} |
| 401 |
?> |
| 402 |
|
| 403 |
|
| 404 |
<div class="taxonomiesui"> |
| 405 |
|
| 406 |
|
| 407 |
<div class="postbox-container"> |
| 408 |
<div id="poststuff"> |
| 409 |
<div class="taxopress-section postbox"> |
| 410 |
<div class="postbox-header"> |
| 411 |
<h2 class="hndle ui-sortable-handle"> |
| 412 |
<?php |
| 413 |
if ($taxonomy_edit) { |
| 414 |
echo esc_html__('Edit Taxonomy', 'simple-tags'); |
| 415 |
} else { |
| 416 |
echo esc_html__('Add new Taxonomy', 'simple-tags'); |
| 417 |
} |
| 418 |
?> |
| 419 |
</h2> |
| 420 |
</div> |
| 421 |
<div class="inside"> |
| 422 |
<div class="main"> |
| 423 |
|
| 424 |
<ul class="st-taxonomy-tab"> |
| 425 |
<li class="taxonomy_general_tab active" data-content="taxonomy_general"> |
| 426 |
<a href="#taxonomy_general"><span><?php esc_html_e('General', |
| 427 |
'simple-tags'); ?></span></a> |
| 428 |
</li> |
| 429 |
|
| 430 |
<li class="taxonomy_posttypes_tab" data-content="taxonomy_posttypes"> |
| 431 |
<a href="#taxonomy_posttypes"><span><?php esc_html_e('Post Types', |
| 432 |
'simple-tags'); ?></span></a> |
| 433 |
</li> |
| 434 |
|
| 435 |
<li class="taxonomy_permalinks_tab" data-content="taxonomy_permalinks"> |
| 436 |
<a href="#taxonomy_permalinks"><span><?php esc_html_e('Permalinks', |
| 437 |
'simple-tags'); ?></span></a> |
| 438 |
</li> |
| 439 |
|
| 440 |
<li class="taxonomy_menus_tab" data-content="taxonomy_menus"> |
| 441 |
<a href="#taxonomy_menus"><span><?php esc_html_e('Admin Area', |
| 442 |
'simple-tags'); ?></span></a> |
| 443 |
</li> |
| 444 |
|
| 445 |
<li class="taxonomy_labels_tab" data-content="taxonomy_labels"> |
| 446 |
<a href="#taxonomy_labels"><span><?php esc_html_e('Other Labels', |
| 447 |
'simple-tags'); ?></span></a> |
| 448 |
</li> |
| 449 |
|
| 450 |
<li class="taxonomy_restapi_tab" data-content="taxonomy_restapi"> |
| 451 |
<a href="#taxonomy_restapi"><span><?php esc_html_e('REST API', |
| 452 |
'simple-tags'); ?></span></a> |
| 453 |
</li> |
| 454 |
|
| 455 |
<li class="taxonomy_advanced_tab" data-content="taxonomy_advanced"> |
| 456 |
<a href="#taxonomy_advanced"><span><?php esc_html_e('Advanced', |
| 457 |
'simple-tags'); ?></span></a> |
| 458 |
</li> |
| 459 |
|
| 460 |
<?php if( $taxonomy_edit && !$external_edit ){ ?> |
| 461 |
<li class="taxonomy_slug_tab" data-content="taxonomy_slug"> |
| 462 |
<a href="#taxonomy_slug"><span><?php esc_html_e('Slug', |
| 463 |
'simple-tags'); ?></span></a> |
| 464 |
</li> |
| 465 |
<?php } ?> |
| 466 |
|
| 467 |
<?php if($taxonomy_edit){ ?> |
| 468 |
<li class="taxonomy_templates_tab" data-content="taxonomy_templates"> |
| 469 |
<a href="#taxonomy_templates"><span><?php esc_html_e('Templates', |
| 470 |
'simple-tags'); ?></span></a> |
| 471 |
</li> |
| 472 |
<?php } ?> |
| 473 |
|
| 474 |
<?php if (!empty($_GET) && !empty($_GET['action']) && 'edit' === $_GET['action']) { ?> |
| 475 |
<li class="taxonomy_delete_tab" data-content="taxonomy_delete"> |
| 476 |
<a href="#taxonomy_delete"><span><?php esc_html_e('Deactivate or Delete', |
| 477 |
'simple-tags'); ?></span></a> |
| 478 |
</li> |
| 479 |
<?php } ?> |
| 480 |
</ul> |
| 481 |
|
| 482 |
|
| 483 |
<div class="st-taxonomy-content"> |
| 484 |
|
| 485 |
|
| 486 |
<table class="form-table taxopress-table taxonomy_general"> |
| 487 |
<?php |
| 488 |
echo $ui->get_tr_start(); |
| 489 |
|
| 490 |
if(!$taxonomy_edit){ |
| 491 |
echo $ui->get_th_start(); |
| 492 |
echo $ui->get_label('name', |
| 493 |
esc_html__('Taxonomy Slug', |
| 494 |
'simple-tags')) . $ui->get_required_span(); |
| 495 |
|
| 496 |
if ('edit' === $tab) { |
| 497 |
echo '<p id="slugchanged" class="hidemessage">' . esc_html__('Slug has changed', |
| 498 |
'simple-tags') . '<span class="dashicons dashicons-warning"></span></p>'; |
| 499 |
} |
| 500 |
echo '<p id="slugexists" class="hidemessage">' . esc_html__('Slug already exists', |
| 501 |
'simple-tags') . '<span class="dashicons dashicons-warning"></span></p>'; |
| 502 |
echo '<p id="st-tags-slug-error-input" class="hidemessage">' . esc_html__('Special character not allowed in slug.', 'simple-tags') . '<span class="dashicons dashicons-warning"></span></p>'; |
| 503 |
|
| 504 |
echo $ui->get_th_end() . $ui->get_td_start(); |
| 505 |
|
| 506 |
echo $ui->get_text_input([ |
| 507 |
'namearray' => 'cpt_custom_tax', |
| 508 |
'name' => 'name', |
| 509 |
'textvalue' => isset($current['name']) ? esc_attr($current['name']) : '', |
| 510 |
'maxlength' => '32', |
| 511 |
'helptext' => 'The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.', |
| 512 |
'class' => 'tax-slug-input', |
| 513 |
'required' => true, |
| 514 |
'placeholder' => false, |
| 515 |
'wrap' => false, |
| 516 |
]); |
| 517 |
|
| 518 |
if ('edit' === $tab) { |
| 519 |
echo '<p>'; |
| 520 |
esc_html_e('DO NOT EDIT the taxonomy slug unless also planning to migrate terms. Changing the slug registers a new taxonomy entry.', |
| 521 |
'simple-tags'); |
| 522 |
echo '</p>'; |
| 523 |
|
| 524 |
echo '<div class="taxopress-spacer">'; |
| 525 |
echo $ui->get_check_input([ |
| 526 |
'checkvalue' => 'update_taxonomy', |
| 527 |
'checked' => 'false', |
| 528 |
'name' => 'update_taxonomy', |
| 529 |
'namearray' => 'update_taxonomy', |
| 530 |
'labeltext' => esc_html__('Migrate terms to newly renamed taxonomy?', |
| 531 |
'simple-tags'), |
| 532 |
'helptext' => '', |
| 533 |
'default' => false, |
| 534 |
'wrap' => false, |
| 535 |
]); |
| 536 |
echo '</div>'; |
| 537 |
} |
| 538 |
|
| 539 |
} |
| 540 |
|
| 541 |
|
| 542 |
|
| 543 |
echo $ui->get_text_input([ |
| 544 |
'namearray' => 'cpt_custom_tax', |
| 545 |
'name' => 'label', |
| 546 |
'textvalue' => isset($current['label']) ? esc_attr($current['label']) : '', |
| 547 |
'aftertext' => esc_html__('(e.g. Jobs)', 'simple-tags'), |
| 548 |
'labeltext' => esc_html__('Plural Label', 'simple-tags'), |
| 549 |
'maxlength' => '100', |
| 550 |
'helptext' => '', |
| 551 |
'required' => true, |
| 552 |
]); |
| 553 |
|
| 554 |
echo $ui->get_text_input([ |
| 555 |
'namearray' => 'cpt_custom_tax', |
| 556 |
'name' => 'singular_label', |
| 557 |
'textvalue' => isset($current['singular_label']) ? esc_attr($current['singular_label']) : '', |
| 558 |
'aftertext' => esc_html__('(e.g. Job)', 'simple-tags'), |
| 559 |
'labeltext' => esc_html__('Singular Label', 'simple-tags'), |
| 560 |
'maxlength' => '100', |
| 561 |
'helptext' => '', |
| 562 |
'required' => true, |
| 563 |
]); |
| 564 |
|
| 565 |
|
| 566 |
|
| 567 |
$select = [ |
| 568 |
'options' => [ |
| 569 |
[ |
| 570 |
'attr' => '0', |
| 571 |
'text' => esc_attr__('False', 'simple-tags'), |
| 572 |
'default' => 'true', |
| 573 |
], |
| 574 |
[ |
| 575 |
'attr' => '1', |
| 576 |
'text' => esc_attr__('True', 'simple-tags'), |
| 577 |
], |
| 578 |
], |
| 579 |
]; |
| 580 |
$selected = isset($current) ? taxopress_disp_boolean($current['hierarchical']) : ''; |
| 581 |
$select['selected'] = !empty($selected) ? $current['hierarchical'] : ''; |
| 582 |
echo $ui->get_select_checkbox_input([ |
| 583 |
'namearray' => 'cpt_custom_tax', |
| 584 |
'name' => 'hierarchical', |
| 585 |
'labeltext' => esc_html__('Parent-Child Relationships', 'simple-tags'), |
| 586 |
'aftertext' => esc_html__('Can terms in this taxonomy be organized into hierarchical relationships?', |
| 587 |
'simple-tags'), |
| 588 |
'selections' => $select, |
| 589 |
]); |
| 590 |
|
| 591 |
|
| 592 |
|
| 593 |
if (isset($current['description'])) { |
| 594 |
$current['description'] = stripslashes_deep($current['description']); |
| 595 |
} |
| 596 |
echo $ui->get_textarea_input([ |
| 597 |
'namearray' => 'cpt_custom_tax', |
| 598 |
'name' => 'description', |
| 599 |
'rows' => '4', |
| 600 |
'cols' => '40', |
| 601 |
'textvalue' => isset($current['description']) ? esc_textarea($current['description']) : '', |
| 602 |
'labeltext' => esc_html__('Description', 'simple-tags'), |
| 603 |
'helptext' => esc_attr__('Describe what your taxonomy is used for.', |
| 604 |
'simple-tags'), |
| 605 |
]); |
| 606 |
|
| 607 |
|
| 608 |
|
| 609 |
echo $ui->get_td_end() . $ui->get_tr_end(); |
| 610 |
?> |
| 611 |
</table> |
| 612 |
|
| 613 |
|
| 614 |
<table class="form-table taxopress-table taxonomy_posttypes" |
| 615 |
style="display:none;"> |
| 616 |
<?php |
| 617 |
|
| 618 |
/** |
| 619 |
* Filters the arguments for post types to list for taxonomy association. |
| 620 |
* |
| 621 |
* |
| 622 |
* @param array $value Array of default arguments. |
| 623 |
*/ |
| 624 |
$args = apply_filters('taxopress_attach_post_types_to_taxonomy', |
| 625 |
['public' => true]); |
| 626 |
|
| 627 |
// If they don't return an array, fall back to the original default. Don't need to check for empty, because empty array is default for $args param in get_post_types anyway. |
| 628 |
if (!is_array($args)) { |
| 629 |
$args = ['public' => true]; |
| 630 |
} |
| 631 |
$output = 'objects'; // Or objects. |
| 632 |
|
| 633 |
/** |
| 634 |
* Filters the results returned to display for available post types for taxonomy. |
| 635 |
* |
| 636 |
* @param array $value Array of post type objects. |
| 637 |
* @param array $args Array of arguments for the post type query. |
| 638 |
* @param string $output The output type we want for the results. |
| 639 |
*/ |
| 640 |
$post_types = apply_filters('taxopress_get_post_types_for_taxonomies', |
| 641 |
get_post_types($args, $output), $args, $output); |
| 642 |
|
| 643 |
foreach ($post_types as $post_type) { |
| 644 |
$core_label = in_array($post_type->name, [ |
| 645 |
'post', |
| 646 |
'page', |
| 647 |
'attachment', |
| 648 |
], true) ? '' : ''; |
| 649 |
|
| 650 |
|
| 651 |
echo '<tr valign="top"><th scope="row"><label for="'.$post_type->name.'">'.$post_type->label.'</label></th><td>'; |
| 652 |
|
| 653 |
echo $ui->get_check_input([ |
| 654 |
'checkvalue' => $post_type->name, |
| 655 |
'checked' => (!empty($current['object_types']) && is_array($current['object_types']) && in_array($post_type->name, |
| 656 |
$current['object_types'], true)) ? 'true' : 'false', |
| 657 |
'name' => $post_type->name, |
| 658 |
'namearray' => 'cpt_post_types', |
| 659 |
'textvalue' => $post_type->name, |
| 660 |
'labeltext' => "", |
| 661 |
'wrap' => false, |
| 662 |
]); |
| 663 |
|
| 664 |
echo '</td></tr>'; |
| 665 |
|
| 666 |
|
| 667 |
} |
| 668 |
|
| 669 |
|
| 670 |
$select = [ |
| 671 |
'options' => [ |
| 672 |
[ |
| 673 |
'attr' => '0', |
| 674 |
'text' => esc_attr__('False', 'simple-tags'), |
| 675 |
'default' => 'true', |
| 676 |
], |
| 677 |
[ |
| 678 |
'attr' => '1', |
| 679 |
'text' => esc_attr__('True', 'simple-tags'), |
| 680 |
], |
| 681 |
], |
| 682 |
]; |
| 683 |
$selected = isset($current) && isset($current['include_in_result']) ? taxopress_disp_boolean($current['include_in_result']) : ''; |
| 684 |
$select['selected'] = !empty($selected) ? $current['include_in_result'] : ''; |
| 685 |
|
| 686 |
echo '<td><hr /></td>'; |
| 687 |
|
| 688 |
echo $ui->get_select_checkbox_input([ |
| 689 |
'namearray' => 'cpt_custom_tax', |
| 690 |
'name' => 'include_in_result', |
| 691 |
'labeltext' => esc_html__('Archive page result', 'simple-tags'), |
| 692 |
'aftertext' => esc_html__('Show content from all post types on archive page', |
| 693 |
'simple-tags'), |
| 694 |
'selections' => $select, |
| 695 |
]); |
| 696 |
|
| 697 |
|
| 698 |
?> |
| 699 |
|
| 700 |
</table> |
| 701 |
|
| 702 |
|
| 703 |
<table class="form-table taxopress-table taxonomy_slug" |
| 704 |
style="display:none;"> |
| 705 |
<?php |
| 706 |
|
| 707 |
|
| 708 |
if($taxonomy_edit){ |
| 709 |
|
| 710 |
echo $ui->get_th_start(); |
| 711 |
echo $ui->get_label('name', |
| 712 |
esc_html__('Taxonomy Slug', |
| 713 |
'simple-tags')) . $ui->get_required_span(); |
| 714 |
|
| 715 |
if ('edit' === $tab) { |
| 716 |
echo '<p id="slugchanged" class="hidemessage">' . esc_html__('Slug has changed', |
| 717 |
'simple-tags') . '<span class="dashicons dashicons-warning"></span></p>'; |
| 718 |
} |
| 719 |
echo '<p id="slugexists" class="hidemessage">' . esc_html__('Slug already exists', |
| 720 |
'simple-tags') . '<span class="dashicons dashicons-warning"></span></p>'; |
| 721 |
|
| 722 |
echo '<p id="st-tags-slug-error-input" class="hidemessage">' . esc_html__('Special character not allowed in slug.', 'simple-tags') . '<span class="dashicons dashicons-warning"></span></p>'; |
| 723 |
|
| 724 |
echo $ui->get_th_end() . $ui->get_td_start(); |
| 725 |
|
| 726 |
echo $ui->get_text_input([ |
| 727 |
'namearray' => 'cpt_custom_tax', |
| 728 |
'name' => 'name', |
| 729 |
'textvalue' => isset($current['name']) ? esc_attr($current['name']) : '', |
| 730 |
'maxlength' => '32', |
| 731 |
'helptext' => 'The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.', |
| 732 |
'class' => 'tax-slug-input', |
| 733 |
'required' => true, |
| 734 |
'placeholder' => false, |
| 735 |
'wrap' => false, |
| 736 |
]); |
| 737 |
|
| 738 |
if ('edit' === $tab) { |
| 739 |
echo '<p>'; |
| 740 |
esc_html_e('DO NOT EDIT the taxonomy slug unless also planning to migrate terms. Changing the slug registers a new taxonomy entry.', |
| 741 |
'simple-tags'); |
| 742 |
echo '</p>'; |
| 743 |
|
| 744 |
echo '<div class="taxopress-spacer">'; |
| 745 |
echo $ui->get_check_input([ |
| 746 |
'checkvalue' => 'update_taxonomy', |
| 747 |
'checked' => 'false', |
| 748 |
'name' => 'update_taxonomy', |
| 749 |
'namearray' => 'update_taxonomy', |
| 750 |
'labeltext' => esc_html__('Migrate terms to newly renamed taxonomy?', |
| 751 |
'simple-tags'), |
| 752 |
'helptext' => '', |
| 753 |
'default' => false, |
| 754 |
'wrap' => false, |
| 755 |
]); |
| 756 |
echo '</div>'; |
| 757 |
} |
| 758 |
|
| 759 |
} |
| 760 |
|
| 761 |
?> |
| 762 |
|
| 763 |
</table> |
| 764 |
|
| 765 |
|
| 766 |
<table class="form-table taxopress-table taxonomy_templates" |
| 767 |
style="display:none;"> |
| 768 |
<?php if (!empty($_GET) && !empty($_GET['action']) && 'edit' === $_GET['action']) { ?> |
| 769 |
<?php |
| 770 |
echo $ui->get_tr_start() . $ui->get_th_start(); |
| 771 |
echo 'Template Hierarchy'; |
| 772 |
echo $ui->get_th_end(); |
| 773 |
|
| 774 |
$template_hierarchy_slug = isset($current['name']) ? esc_attr($current['name']) : ''; |
| 775 |
$template_hierarchy = ' |
| 776 |
<ul style="margin-top: 0;"> |
| 777 |
<li style="list-style: decimal;">taxonomy-'.esc_html( $template_hierarchy_slug ).'-term_slug.php *</li> |
| 778 |
<li style="list-style: decimal;">taxonomy-'. esc_html( $template_hierarchy_slug ).'.php</li> |
| 779 |
<li style="list-style: decimal;">taxonomy.php</li> |
| 780 |
<li style="list-style: decimal;">archive.php</li> |
| 781 |
<li style="list-style: decimal;">index.php</li> |
| 782 |
</ul> |
| 783 |
<p style="font-weight:bolder;">'.esc_html__( '*Replace "term_slug" with the slug of the actual taxonomy term.', 'simple-tags' ).'</p>'; |
| 784 |
|
| 785 |
echo '<td>'; |
| 786 |
echo $template_hierarchy; |
| 787 |
echo '</td>'; |
| 788 |
} |
| 789 |
|
| 790 |
echo $ui->get_tr_end(); |
| 791 |
|
| 792 |
|
| 793 |
?> |
| 794 |
</table> |
| 795 |
|
| 796 |
|
| 797 |
<table class="form-table taxopress-table taxonomy_permalinks" |
| 798 |
style="display:none;"> |
| 799 |
<?php |
| 800 |
|
| 801 |
|
| 802 |
$select = [ |
| 803 |
'options' => [ |
| 804 |
[ |
| 805 |
'attr' => '0', |
| 806 |
'text' => esc_attr__('False', 'simple-tags'), |
| 807 |
], |
| 808 |
[ |
| 809 |
'attr' => '1', |
| 810 |
'text' => esc_attr__('True', 'simple-tags'), |
| 811 |
'default' => 'true', |
| 812 |
], |
| 813 |
], |
| 814 |
]; |
| 815 |
$selected = isset($current) ? taxopress_disp_boolean($current['rewrite']) : ''; |
| 816 |
$select['selected'] = !empty($selected) ? $current['rewrite'] : ''; |
| 817 |
echo $ui->get_select_checkbox_input([ |
| 818 |
'namearray' => 'cpt_custom_tax', |
| 819 |
'name' => 'rewrite', |
| 820 |
'labeltext' => esc_html__('Rewrite', 'simple-tags'), |
| 821 |
'aftertext' => esc_html__('WordPress can use a custom permalink for this taxonomy. It does not have to match the slug.', |
| 822 |
'simple-tags'), |
| 823 |
'selections' => $select, |
| 824 |
]); |
| 825 |
|
| 826 |
echo $ui->get_text_input([ |
| 827 |
'namearray' => 'cpt_custom_tax', |
| 828 |
'name' => 'rewrite_slug', |
| 829 |
'textvalue' => isset($current['rewrite_slug']) ? esc_attr($current['rewrite_slug']) : '', |
| 830 |
'aftertext' => esc_attr__('(default: taxonomy name)', 'simple-tags'), |
| 831 |
'labeltext' => esc_html__('Custom Rewrite Slug', 'simple-tags'), |
| 832 |
'helptext' => esc_html__('Custom taxonomy rewrite slug.', |
| 833 |
'simple-tags'), |
| 834 |
]); |
| 835 |
|
| 836 |
$select = [ |
| 837 |
'options' => [ |
| 838 |
[ |
| 839 |
'attr' => '0', |
| 840 |
'text' => esc_attr__('False', 'simple-tags'), |
| 841 |
], |
| 842 |
[ |
| 843 |
'attr' => '1', |
| 844 |
'text' => esc_attr__('True', 'simple-tags'), |
| 845 |
'default' => 'true', |
| 846 |
], |
| 847 |
], |
| 848 |
]; |
| 849 |
$selected = isset($current) ? taxopress_disp_boolean($current['rewrite_withfront']) : ''; |
| 850 |
$select['selected'] = !empty($selected) ? $current['rewrite_withfront'] : ''; |
| 851 |
echo $ui->get_select_checkbox_input([ |
| 852 |
'namearray' => 'cpt_custom_tax', |
| 853 |
'name' => 'rewrite_withfront', |
| 854 |
'labeltext' => esc_html__('Rewrite With Front', 'simple-tags'), |
| 855 |
'aftertext' => esc_html__('Should the permastruct be prepended with the front base.', |
| 856 |
'simple-tags'), |
| 857 |
'selections' => $select, |
| 858 |
]); |
| 859 |
|
| 860 |
$select = [ |
| 861 |
'options' => [ |
| 862 |
[ |
| 863 |
'attr' => '0', |
| 864 |
'text' => esc_attr__('False', 'simple-tags'), |
| 865 |
'default' => 'false', |
| 866 |
], |
| 867 |
[ |
| 868 |
'attr' => '1', |
| 869 |
'text' => esc_attr__('True', 'simple-tags'), |
| 870 |
], |
| 871 |
], |
| 872 |
]; |
| 873 |
$selected = isset($current) ? taxopress_disp_boolean($current['rewrite_hierarchical']) : ''; |
| 874 |
$select['selected'] = !empty($selected) ? $current['rewrite_hierarchical'] : ''; |
| 875 |
echo $ui->get_select_checkbox_input([ |
| 876 |
'namearray' => 'cpt_custom_tax', |
| 877 |
'name' => 'rewrite_hierarchical', |
| 878 |
'labeltext' => esc_html__('Rewrite Hierarchical', 'simple-tags'), |
| 879 |
'aftertext' => esc_html__('Should the permastruct allow hierarchical urls.', |
| 880 |
'simple-tags'), |
| 881 |
'selections' => $select, |
| 882 |
]); |
| 883 |
|
| 884 |
?> |
| 885 |
|
| 886 |
</table> |
| 887 |
|
| 888 |
|
| 889 |
<table class="form-table taxopress-table taxonomy_menus" |
| 890 |
style="display:none;"> |
| 891 |
<?php |
| 892 |
|
| 893 |
|
| 894 |
$select = [ |
| 895 |
'options' => [ |
| 896 |
[ |
| 897 |
'attr' => '0', |
| 898 |
'text' => esc_attr__('False', 'simple-tags'), |
| 899 |
], |
| 900 |
[ |
| 901 |
'attr' => '1', |
| 902 |
'text' => esc_attr__('True', 'simple-tags'), |
| 903 |
'default' => 'true', |
| 904 |
], |
| 905 |
], |
| 906 |
]; |
| 907 |
$selected = isset($current) ? taxopress_disp_boolean($current['show_ui']) : ''; |
| 908 |
$select['selected'] = !empty($selected) ? $current['show_ui'] : ''; |
| 909 |
echo $ui->get_select_checkbox_input([ |
| 910 |
'namearray' => 'cpt_custom_tax', |
| 911 |
'name' => 'show_ui', |
| 912 |
'labeltext' => esc_html__('Show user interface', 'simple-tags'), |
| 913 |
'aftertext' => '', |
| 914 |
'selections' => $select, |
| 915 |
]); |
| 916 |
|
| 917 |
$select = [ |
| 918 |
'options' => [ |
| 919 |
[ |
| 920 |
'attr' => '0', |
| 921 |
'text' => esc_attr__('False', 'simple-tags'), |
| 922 |
], |
| 923 |
[ |
| 924 |
'attr' => '1', |
| 925 |
'text' => esc_attr__('True', 'simple-tags'), |
| 926 |
'default' => 'true', |
| 927 |
], |
| 928 |
], |
| 929 |
]; |
| 930 |
$selected = isset($current) ? taxopress_disp_boolean($current['show_in_menu']) : ''; |
| 931 |
$select['selected'] = !empty($selected) ? $current['show_in_menu'] : ''; |
| 932 |
echo $ui->get_select_checkbox_input([ |
| 933 |
'namearray' => 'cpt_custom_tax', |
| 934 |
'name' => 'show_in_menu', |
| 935 |
'labeltext' => esc_html__('Show in admin menus', 'simple-tags'), |
| 936 |
'aftertext' => '', |
| 937 |
'selections' => $select, |
| 938 |
]); |
| 939 |
|
| 940 |
$select = [ |
| 941 |
'options' => [ |
| 942 |
[ |
| 943 |
'attr' => '0', |
| 944 |
'text' => esc_attr__('False', 'simple-tags'), |
| 945 |
], |
| 946 |
[ |
| 947 |
'attr' => '1', |
| 948 |
'text' => esc_attr__('True', 'simple-tags'), |
| 949 |
'default' => 'true', |
| 950 |
], |
| 951 |
], |
| 952 |
]; |
| 953 |
$selected = (isset($current) && !empty($current['show_in_nav_menus'])) ? taxopress_disp_boolean($current['show_in_nav_menus']) : ''; |
| 954 |
$select['selected'] = !empty($selected) ? $current['show_in_nav_menus'] : ''; |
| 955 |
echo $ui->get_select_checkbox_input([ |
| 956 |
'namearray' => 'cpt_custom_tax', |
| 957 |
'name' => 'show_in_nav_menus', |
| 958 |
'labeltext' => esc_html__('Show in frontend menus', 'simple-tags'), |
| 959 |
'aftertext' => '', |
| 960 |
'selections' => $select, |
| 961 |
]); |
| 962 |
|
| 963 |
|
| 964 |
$select = [ |
| 965 |
'options' => [ |
| 966 |
[ |
| 967 |
'attr' => '0', |
| 968 |
'text' => esc_attr__('False', 'simple-tags'), |
| 969 |
'default' => 'true', |
| 970 |
], |
| 971 |
[ |
| 972 |
'attr' => '1', |
| 973 |
'text' => esc_attr__('True', 'simple-tags'), |
| 974 |
], |
| 975 |
], |
| 976 |
]; |
| 977 |
$selected = isset($current) ? taxopress_disp_boolean($current['show_admin_column']) : ''; |
| 978 |
$select['selected'] = !empty($selected) ? $current['show_admin_column'] : ''; |
| 979 |
echo $ui->get_select_checkbox_input([ |
| 980 |
'namearray' => 'cpt_custom_tax', |
| 981 |
'name' => 'show_admin_column', |
| 982 |
'labeltext' => esc_html__('Show admin column', 'simple-tags'), |
| 983 |
'aftertext' => '', |
| 984 |
'selections' => $select, |
| 985 |
]); |
| 986 |
|
| 987 |
$select = [ |
| 988 |
'options' => [ |
| 989 |
[ |
| 990 |
'attr' => '0', |
| 991 |
'text' => esc_attr__('False', 'simple-tags'), |
| 992 |
'default' => 'false', |
| 993 |
], |
| 994 |
[ |
| 995 |
'attr' => '1', |
| 996 |
'text' => esc_attr__('True', 'simple-tags'), |
| 997 |
], |
| 998 |
], |
| 999 |
]; |
| 1000 |
$selected = (isset($current) && !empty($current['show_in_quick_edit'])) ? taxopress_disp_boolean($current['show_in_quick_edit']) : ''; |
| 1001 |
$select['selected'] = !empty($selected) ? $current['show_in_quick_edit'] : ''; |
| 1002 |
echo $ui->get_select_checkbox_input([ |
| 1003 |
'namearray' => 'cpt_custom_tax', |
| 1004 |
'name' => 'show_in_quick_edit', |
| 1005 |
'labeltext' => esc_html__('Show in "Quick Edit" and "Bulk Edit"', |
| 1006 |
'simple-tags'), |
| 1007 |
'aftertext' => '', |
| 1008 |
'selections' => $select, |
| 1009 |
]); |
| 1010 |
|
| 1011 |
?> |
| 1012 |
|
| 1013 |
</table> |
| 1014 |
|
| 1015 |
|
| 1016 |
<table class="form-table taxopress-table taxonomy_labels" |
| 1017 |
style="display:none;"> |
| 1018 |
|
| 1019 |
<?php |
| 1020 |
|
| 1021 |
echo $ui->get_text_input([ |
| 1022 |
'namearray' => 'cpt_tax_labels', |
| 1023 |
'name' => 'menu_name', |
| 1024 |
'textvalue' => isset($current['labels']['menu_name']) ? esc_attr($current['labels']['menu_name']) : '', |
| 1025 |
'aftertext' => esc_attr__('(e.g. Jobs)', 'simple-tags'), |
| 1026 |
'labeltext' => esc_html__('Menu Name', 'simple-tags'), |
| 1027 |
'helptext' => esc_html__('Custom admin menu name for your taxonomy.', |
| 1028 |
'simple-tags'), |
| 1029 |
'maxlength' => '100', |
| 1030 |
'data' => [ |
| 1031 |
'label' => 'item', // Not localizing because it's isolated. |
| 1032 |
'plurality' => 'plural', |
| 1033 |
], |
| 1034 |
]); |
| 1035 |
|
| 1036 |
echo $ui->get_text_input([ |
| 1037 |
'namearray' => 'cpt_tax_labels', |
| 1038 |
'name' => 'all_items', |
| 1039 |
'textvalue' => isset($current['labels']['all_items']) ? esc_attr($current['labels']['all_items']) : '', |
| 1040 |
'aftertext' => esc_attr__('(e.g. All Jobs)', 'simple-tags'), |
| 1041 |
'labeltext' => esc_html__('All Items', 'simple-tags'), |
| 1042 |
'helptext' => esc_html__('Used as tab text when showing all terms for hierarchical taxonomy while editing post.', |
| 1043 |
'simple-tags'), |
| 1044 |
'data' => [ |
| 1045 |
/* translators: Used for autofill */ |
| 1046 |
'label' => sprintf(esc_attr__('All %s', 'simple-tags'), |
| 1047 |
'item'), |
| 1048 |
'plurality' => 'plural', |
| 1049 |
], |
| 1050 |
]); |
| 1051 |
|
| 1052 |
echo $ui->get_text_input([ |
| 1053 |
'namearray' => 'cpt_tax_labels', |
| 1054 |
'name' => 'edit_item', |
| 1055 |
'textvalue' => isset($current['labels']['edit_item']) ? esc_attr($current['labels']['edit_item']) : '', |
| 1056 |
'aftertext' => esc_attr__('(e.g. Edit Job)', 'simple-tags'), |
| 1057 |
'labeltext' => esc_html__('Edit Item', 'simple-tags'), |
| 1058 |
'helptext' => esc_html__('Used at the top of the term editor screen for an existing taxonomy term.', |
| 1059 |
'simple-tags'), |
| 1060 |
'data' => [ |
| 1061 |
/* translators: Used for autofill */ |
| 1062 |
'label' => sprintf(esc_attr__('Edit %s', 'simple-tags'), |
| 1063 |
'item'), |
| 1064 |
'plurality' => 'singular', |
| 1065 |
], |
| 1066 |
]); |
| 1067 |
|
| 1068 |
echo $ui->get_text_input([ |
| 1069 |
'namearray' => 'cpt_tax_labels', |
| 1070 |
'name' => 'view_item', |
| 1071 |
'textvalue' => isset($current['labels']['view_item']) ? esc_attr($current['labels']['view_item']) : '', |
| 1072 |
'aftertext' => esc_attr__('(e.g. View Job)', 'simple-tags'), |
| 1073 |
'labeltext' => esc_html__('View Item', 'simple-tags'), |
| 1074 |
'helptext' => esc_html__('Used in the admin bar when viewing editor screen for an existing taxonomy term.', |
| 1075 |
'simple-tags'), |
| 1076 |
'data' => [ |
| 1077 |
/* translators: Used for autofill */ |
| 1078 |
'label' => sprintf(esc_attr__('View %s', 'simple-tags'), |
| 1079 |
'item'), |
| 1080 |
'plurality' => 'singular', |
| 1081 |
], |
| 1082 |
]); |
| 1083 |
|
| 1084 |
echo $ui->get_text_input([ |
| 1085 |
'namearray' => 'cpt_tax_labels', |
| 1086 |
'name' => 'update_item', |
| 1087 |
'textvalue' => isset($current['labels']['update_item']) ? esc_attr($current['labels']['update_item']) : '', |
| 1088 |
'aftertext' => esc_attr__('(e.g. Update Job Name)', 'simple-tags'), |
| 1089 |
'labeltext' => esc_html__('Update Item Name', 'simple-tags'), |
| 1090 |
'helptext' => esc_html__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', |
| 1091 |
'simple-tags'), |
| 1092 |
'data' => [ |
| 1093 |
/* translators: Used for autofill */ |
| 1094 |
'label' => sprintf(esc_attr__('Update %s name', |
| 1095 |
'simple-tags'), |
| 1096 |
'item'), |
| 1097 |
'plurality' => 'singular', |
| 1098 |
], |
| 1099 |
]); |
| 1100 |
|
| 1101 |
echo $ui->get_text_input([ |
| 1102 |
'namearray' => 'cpt_tax_labels', |
| 1103 |
'name' => 'add_new_item', |
| 1104 |
'textvalue' => isset($current['labels']['add_new_item']) ? esc_attr($current['labels']['add_new_item']) : '', |
| 1105 |
'aftertext' => esc_attr__('(e.g. Add New Job)', 'simple-tags'), |
| 1106 |
'labeltext' => esc_html__('Add New Item', 'simple-tags'), |
| 1107 |
'helptext' => esc_html__('Used at the top of the term editor screen and button text for a new taxonomy term.', |
| 1108 |
'simple-tags'), |
| 1109 |
'data' => [ |
| 1110 |
/* translators: Used for autofill */ |
| 1111 |
'label' => sprintf(esc_attr__('Add new %s', 'simple-tags'), |
| 1112 |
'item'), |
| 1113 |
'plurality' => 'singular', |
| 1114 |
], |
| 1115 |
]); |
| 1116 |
|
| 1117 |
echo $ui->get_text_input([ |
| 1118 |
'namearray' => 'cpt_tax_labels', |
| 1119 |
'name' => 'new_item_name', |
| 1120 |
'textvalue' => isset($current['labels']['new_item_name']) ? esc_attr($current['labels']['new_item_name']) : '', |
| 1121 |
'aftertext' => esc_attr__('(e.g. New Job Name)', 'simple-tags'), |
| 1122 |
'labeltext' => esc_html__('New Item Name', 'simple-tags'), |
| 1123 |
'helptext' => esc_html__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', |
| 1124 |
'simple-tags'), |
| 1125 |
'data' => [ |
| 1126 |
/* translators: Used for autofill */ |
| 1127 |
'label' => sprintf(esc_attr__('New %s name', 'simple-tags'), |
| 1128 |
'item'), |
| 1129 |
'plurality' => 'singular', |
| 1130 |
], |
| 1131 |
]); |
| 1132 |
|
| 1133 |
echo $ui->get_text_input([ |
| 1134 |
'namearray' => 'cpt_tax_labels', |
| 1135 |
'name' => 'parent_item', |
| 1136 |
'textvalue' => isset($current['labels']['parent_item']) ? esc_attr($current['labels']['parent_item']) : '', |
| 1137 |
'aftertext' => esc_attr__('(e.g. Parent Job)', 'simple-tags'), |
| 1138 |
'labeltext' => esc_html__('Parent Item', 'simple-tags'), |
| 1139 |
'helptext' => esc_html__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', |
| 1140 |
'simple-tags'), |
| 1141 |
'data' => [ |
| 1142 |
/* translators: Used for autofill */ |
| 1143 |
'label' => sprintf(esc_attr__('Parent %s', 'simple-tags'), |
| 1144 |
'item'), |
| 1145 |
'plurality' => 'singular', |
| 1146 |
], |
| 1147 |
]); |
| 1148 |
|
| 1149 |
echo $ui->get_text_input([ |
| 1150 |
'namearray' => 'cpt_tax_labels', |
| 1151 |
'name' => 'parent_item_colon', |
| 1152 |
'textvalue' => isset($current['labels']['parent_item_colon']) ? esc_attr($current['labels']['parent_item_colon']) : '', |
| 1153 |
'aftertext' => esc_attr__('(e.g. Parent Job:)', 'simple-tags'), |
| 1154 |
'labeltext' => esc_html__('Parent Item Colon', 'simple-tags'), |
| 1155 |
'helptext' => esc_html__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', |
| 1156 |
'simple-tags'), |
| 1157 |
'data' => [ |
| 1158 |
/* translators: Used for autofill */ |
| 1159 |
'label' => sprintf(esc_attr__('Parent %s:', 'simple-tags'), |
| 1160 |
'item'), |
| 1161 |
'plurality' => 'singular', |
| 1162 |
], |
| 1163 |
]); |
| 1164 |
|
| 1165 |
echo $ui->get_text_input([ |
| 1166 |
'namearray' => 'cpt_tax_labels', |
| 1167 |
'name' => 'search_items', |
| 1168 |
'textvalue' => isset($current['labels']['search_items']) ? esc_attr($current['labels']['search_items']) : '', |
| 1169 |
'aftertext' => esc_attr__('(e.g. Search Jobs)', 'simple-tags'), |
| 1170 |
'labeltext' => esc_html__('Search Items', 'simple-tags'), |
| 1171 |
'helptext' => esc_html__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', |
| 1172 |
'simple-tags'), |
| 1173 |
'data' => [ |
| 1174 |
/* translators: Used for autofill */ |
| 1175 |
'label' => sprintf(esc_attr__('Search %s', 'simple-tags'), |
| 1176 |
'item'), |
| 1177 |
'plurality' => 'plural', |
| 1178 |
], |
| 1179 |
]); |
| 1180 |
|
| 1181 |
echo $ui->get_text_input([ |
| 1182 |
'namearray' => 'cpt_tax_labels', |
| 1183 |
'name' => 'popular_items', |
| 1184 |
'textvalue' => isset($current['labels']['popular_items']) ? esc_attr($current['labels']['popular_items']) : null, |
| 1185 |
'aftertext' => esc_attr__('(e.g. Popular Jobs)', 'simple-tags'), |
| 1186 |
'labeltext' => esc_html__('Popular Items', 'simple-tags'), |
| 1187 |
'helptext' => esc_html__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', |
| 1188 |
'simple-tags'), |
| 1189 |
'data' => [ |
| 1190 |
/* translators: Used for autofill */ |
| 1191 |
'label' => sprintf(esc_attr__('Popular %s', 'simple-tags'), |
| 1192 |
'item'), |
| 1193 |
'plurality' => 'plural', |
| 1194 |
], |
| 1195 |
]); |
| 1196 |
|
| 1197 |
echo $ui->get_text_input([ |
| 1198 |
'namearray' => 'cpt_tax_labels', |
| 1199 |
'name' => 'separate_items_with_commas', |
| 1200 |
'textvalue' => isset($current['labels']['separate_items_with_commas']) ? esc_attr($current['labels']['separate_items_with_commas']) : null, |
| 1201 |
'aftertext' => esc_attr__('(e.g. Separate Jobs with commas)', |
| 1202 |
'simple-tags'), |
| 1203 |
'labeltext' => esc_html__('Separate Items with Commas', |
| 1204 |
'simple-tags'), |
| 1205 |
'helptext' => esc_html__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', |
| 1206 |
'simple-tags'), |
| 1207 |
'data' => [ |
| 1208 |
/* translators: Used for autofill */ |
| 1209 |
'label' => sprintf(esc_attr__('Separate %s with commas', |
| 1210 |
'simple-tags'), 'item'), |
| 1211 |
'plurality' => 'plural', |
| 1212 |
], |
| 1213 |
]); |
| 1214 |
|
| 1215 |
echo $ui->get_text_input([ |
| 1216 |
'namearray' => 'cpt_tax_labels', |
| 1217 |
'name' => 'add_or_remove_items', |
| 1218 |
'textvalue' => isset($current['labels']['add_or_remove_items']) ? esc_attr($current['labels']['add_or_remove_items']) : null, |
| 1219 |
'aftertext' => esc_attr__('(e.g. Add or remove Jobs)', |
| 1220 |
'simple-tags'), |
| 1221 |
'labeltext' => esc_html__('Add or Remove Items', 'simple-tags'), |
| 1222 |
'helptext' => esc_html__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', |
| 1223 |
'simple-tags'), |
| 1224 |
'data' => [ |
| 1225 |
/* translators: Used for autofill */ |
| 1226 |
'label' => sprintf(esc_attr__('Add or remove %s', |
| 1227 |
'simple-tags'), |
| 1228 |
'item'), |
| 1229 |
'plurality' => 'plural', |
| 1230 |
], |
| 1231 |
]); |
| 1232 |
|
| 1233 |
echo $ui->get_text_input([ |
| 1234 |
'namearray' => 'cpt_tax_labels', |
| 1235 |
'name' => 'choose_from_most_used', |
| 1236 |
'textvalue' => isset($current['labels']['choose_from_most_used']) ? esc_attr($current['labels']['choose_from_most_used']) : null, |
| 1237 |
'aftertext' => esc_attr__('(e.g. Choose from the most used Jobs)', |
| 1238 |
'simple-tags'), |
| 1239 |
'labeltext' => esc_html__('Choose From Most Used', 'simple-tags'), |
| 1240 |
'helptext' => esc_html__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', |
| 1241 |
'simple-tags'), |
| 1242 |
'data' => [ |
| 1243 |
/* translators: Used for autofill */ |
| 1244 |
'label' => sprintf(esc_attr__('Choose from the most used %s', |
| 1245 |
'simple-tags'), 'item'), |
| 1246 |
'plurality' => 'plural', |
| 1247 |
], |
| 1248 |
]); |
| 1249 |
|
| 1250 |
echo $ui->get_text_input([ |
| 1251 |
'namearray' => 'cpt_tax_labels', |
| 1252 |
'name' => 'not_found', |
| 1253 |
'textvalue' => isset($current['labels']['not_found']) ? esc_attr($current['labels']['not_found']) : null, |
| 1254 |
'aftertext' => esc_attr__('(e.g. No Jobs found)', 'simple-tags'), |
| 1255 |
'labeltext' => esc_html__('Not found', 'simple-tags'), |
| 1256 |
'helptext' => esc_html__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', |
| 1257 |
'simple-tags'), |
| 1258 |
'data' => [ |
| 1259 |
/* translators: Used for autofill */ |
| 1260 |
'label' => sprintf(esc_attr__('No %s found', 'simple-tags'), |
| 1261 |
'item'), |
| 1262 |
'plurality' => 'plural', |
| 1263 |
], |
| 1264 |
]); |
| 1265 |
|
| 1266 |
echo $ui->get_text_input([ |
| 1267 |
'namearray' => 'cpt_tax_labels', |
| 1268 |
'name' => 'no_terms', |
| 1269 |
'textvalue' => isset($current['labels']['no_terms']) ? esc_attr($current['labels']['no_terms']) : null, |
| 1270 |
'aftertext' => esc_html__('(e.g. No jobs)', 'simple-tags'), |
| 1271 |
'labeltext' => esc_html__('No terms', 'simple-tags'), |
| 1272 |
'helptext' => esc_attr__('Used when indicating that there are no terms in the given taxonomy associated with an object.', |
| 1273 |
'simple-tags'), |
| 1274 |
'data' => [ |
| 1275 |
/* translators: Used for autofill */ |
| 1276 |
'label' => sprintf(esc_attr__('No %s', 'simple-tags'), |
| 1277 |
'item'), |
| 1278 |
'plurality' => 'plural', |
| 1279 |
], |
| 1280 |
]); |
| 1281 |
|
| 1282 |
echo $ui->get_text_input([ |
| 1283 |
'namearray' => 'cpt_tax_labels', |
| 1284 |
'name' => 'items_list_navigation', |
| 1285 |
'textvalue' => isset($current['labels']['items_list_navigation']) ? esc_attr($current['labels']['items_list_navigation']) : null, |
| 1286 |
'aftertext' => esc_html__('(e.g. Jobs list navigation)', |
| 1287 |
'simple-tags'), |
| 1288 |
'labeltext' => esc_html__('Items List Navigation', 'simple-tags'), |
| 1289 |
'helptext' => esc_attr__('Screen reader text for the pagination heading on the term listing screen.', |
| 1290 |
'simple-tags'), |
| 1291 |
'data' => [ |
| 1292 |
/* translators: Used for autofill */ |
| 1293 |
'label' => sprintf(esc_attr__('%s list navigation', |
| 1294 |
'simple-tags'), |
| 1295 |
'item'), |
| 1296 |
'plurality' => 'plural', |
| 1297 |
], |
| 1298 |
]); |
| 1299 |
|
| 1300 |
echo $ui->get_text_input([ |
| 1301 |
'namearray' => 'cpt_tax_labels', |
| 1302 |
'name' => 'items_list', |
| 1303 |
'textvalue' => isset($current['labels']['items_list']) ? esc_attr($current['labels']['items_list']) : null, |
| 1304 |
'aftertext' => esc_html__('(e.g. Jobs list)', 'simple-tags'), |
| 1305 |
'labeltext' => esc_html__('Items List', 'simple-tags'), |
| 1306 |
'helptext' => esc_attr__('Screen reader text for the items list heading on the term listing screen.', |
| 1307 |
'simple-tags'), |
| 1308 |
'data' => [ |
| 1309 |
/* translators: Used for autofill */ |
| 1310 |
'label' => sprintf(esc_attr__('%s list', 'simple-tags'), |
| 1311 |
'item'), |
| 1312 |
'plurality' => 'plural', |
| 1313 |
], |
| 1314 |
]); |
| 1315 |
|
| 1316 |
echo $ui->get_text_input([ |
| 1317 |
'namearray' => 'cpt_tax_labels', |
| 1318 |
'name' => 'not_found', |
| 1319 |
'textvalue' => isset($current['labels']['not_found']) ? esc_attr($current['labels']['not_found']) : null, |
| 1320 |
'aftertext' => esc_html__('(e.g. No jobs found)', 'simple-tags'), |
| 1321 |
'labeltext' => esc_html__('Not Found', 'simple-tags'), |
| 1322 |
'helptext' => esc_attr__('The text displayed via clicking ‘Choose from the most used items’ in the taxonomy meta box when no items are available.', |
| 1323 |
'simple-tags'), |
| 1324 |
'data' => [ |
| 1325 |
/* translators: Used for autofill */ |
| 1326 |
'label' => sprintf(esc_attr__('No %s found', 'simple-tags'), |
| 1327 |
'item'), |
| 1328 |
'plurality' => 'plural', |
| 1329 |
], |
| 1330 |
]); |
| 1331 |
|
| 1332 |
echo $ui->get_text_input([ |
| 1333 |
'namearray' => 'cpt_tax_labels', |
| 1334 |
'name' => 'back_to_items', |
| 1335 |
'textvalue' => isset($current['labels']['back_to_items']) ? esc_attr($current['labels']['back_to_items']) : null, |
| 1336 |
'aftertext' => esc_html__('(e.g. ← Back to jobs', |
| 1337 |
'simple-tags'), |
| 1338 |
'labeltext' => esc_html__('Back to Items', 'simple-tags'), |
| 1339 |
'helptext' => esc_attr__('The text displayed after a term has been updated for a link back to main index.', |
| 1340 |
'simple-tags'), |
| 1341 |
'data' => [ |
| 1342 |
/* translators: Used for autofill */ |
| 1343 |
'label' => sprintf(esc_attr__('Back to %s', 'simple-tags'), |
| 1344 |
'item'), |
| 1345 |
'plurality' => 'plural', |
| 1346 |
], |
| 1347 |
]); |
| 1348 |
?> |
| 1349 |
</table> |
| 1350 |
|
| 1351 |
<table class="form-table taxopress-table taxonomy_restapi" |
| 1352 |
style="display:none;"> |
| 1353 |
<?php |
| 1354 |
|
| 1355 |
$select = [ |
| 1356 |
'options' => [ |
| 1357 |
[ |
| 1358 |
'attr' => '0', |
| 1359 |
'text' => esc_attr__('False', 'simple-tags'), |
| 1360 |
], |
| 1361 |
[ |
| 1362 |
'attr' => '1', |
| 1363 |
'text' => esc_attr__('True', 'simple-tags'), |
| 1364 |
'default' => 'true', |
| 1365 |
], |
| 1366 |
], |
| 1367 |
]; |
| 1368 |
$selected = isset($current) ? taxopress_disp_boolean($current['show_in_rest']) : ''; |
| 1369 |
$select['selected'] = !empty($selected) ? $current['show_in_rest'] : ''; |
| 1370 |
echo $ui->get_select_checkbox_input([ |
| 1371 |
'namearray' => 'cpt_custom_tax', |
| 1372 |
'name' => 'show_in_rest', |
| 1373 |
'labeltext' => esc_html__('Show in REST API', 'simple-tags'), |
| 1374 |
'aftertext' => '', |
| 1375 |
'selections' => $select, |
| 1376 |
]); |
| 1377 |
|
| 1378 |
echo $ui->get_text_input([ |
| 1379 |
'namearray' => 'cpt_custom_tax', |
| 1380 |
'name' => 'rest_base', |
| 1381 |
'labeltext' => esc_html__('REST API base slug', 'simple-tags'), |
| 1382 |
'helptext' => esc_attr__('Slug to use in REST API URLs.', |
| 1383 |
'simple-tags'), |
| 1384 |
'textvalue' => isset($current['rest_base']) ? esc_attr($current['rest_base']) : '', |
| 1385 |
]); |
| 1386 |
|
| 1387 |
echo $ui->get_text_input([ |
| 1388 |
'namearray' => 'cpt_custom_tax', |
| 1389 |
'name' => 'rest_controller_class', |
| 1390 |
'labeltext' => esc_html__('REST API controller class', |
| 1391 |
'simple-tags'), |
| 1392 |
'aftertext' => esc_attr__('Custom controller to use instead of WP_REST_Terms_Controller.', |
| 1393 |
'simple-tags'), |
| 1394 |
'textvalue' => isset($current['rest_controller_class']) ? esc_attr($current['rest_controller_class']) : '', |
| 1395 |
]); |
| 1396 |
|
| 1397 |
|
| 1398 |
?> |
| 1399 |
|
| 1400 |
</div> |
| 1401 |
|
| 1402 |
|
| 1403 |
<table class="form-table taxopress-table taxonomy_advanced" |
| 1404 |
style="display:none;"> |
| 1405 |
<?php |
| 1406 |
|
| 1407 |
$select = [ |
| 1408 |
'options' => [ |
| 1409 |
[ |
| 1410 |
'attr' => '0', |
| 1411 |
'text' => esc_attr__('False', 'simple-tags'), |
| 1412 |
], |
| 1413 |
[ |
| 1414 |
'attr' => '1', |
| 1415 |
'text' => esc_attr__('True', 'simple-tags'), |
| 1416 |
'default' => 'true', |
| 1417 |
], |
| 1418 |
], |
| 1419 |
]; |
| 1420 |
$selected = isset($current) ? taxopress_disp_boolean($current['public']) : ''; |
| 1421 |
$select['selected'] = !empty($selected) ? $current['public'] : ''; |
| 1422 |
echo $ui->get_select_checkbox_input([ |
| 1423 |
'namearray' => 'cpt_custom_tax', |
| 1424 |
'name' => 'public', |
| 1425 |
'labeltext' => esc_html__('Public', 'simple-tags'), |
| 1426 |
'aftertext' => esc_html__('The taxonomy is for public use. It can be seen by frontend users.', |
| 1427 |
'simple-tags'), |
| 1428 |
'selections' => $select, |
| 1429 |
]); |
| 1430 |
|
| 1431 |
$select = [ |
| 1432 |
'options' => [ |
| 1433 |
[ |
| 1434 |
'attr' => '0', |
| 1435 |
'text' => esc_attr__('False', 'simple-tags'), |
| 1436 |
], |
| 1437 |
[ |
| 1438 |
'attr' => '1', |
| 1439 |
'text' => esc_attr__('True', 'simple-tags'), |
| 1440 |
'default' => 'true', |
| 1441 |
], |
| 1442 |
], |
| 1443 |
]; |
| 1444 |
$selected = isset($current) ? taxopress_disp_boolean($current['publicly_queryable']) : ''; |
| 1445 |
$select['selected'] = !empty($selected) ? $current['publicly_queryable'] : ''; |
| 1446 |
echo $ui->get_select_checkbox_input([ |
| 1447 |
'namearray' => 'cpt_custom_tax', |
| 1448 |
'name' => 'publicly_queryable', |
| 1449 |
'labeltext' => esc_html__('Public Queryable', 'simple-tags'), |
| 1450 |
'aftertext' => esc_html__('The taxonomy is publicly queryable.', |
| 1451 |
'simple-tags'), |
| 1452 |
'selections' => $select, |
| 1453 |
]); |
| 1454 |
|
| 1455 |
$select = [ |
| 1456 |
'options' => [ |
| 1457 |
[ |
| 1458 |
'attr' => '0', |
| 1459 |
'text' => esc_attr__('False', 'simple-tags'), |
| 1460 |
], |
| 1461 |
[ |
| 1462 |
'attr' => '1', |
| 1463 |
'text' => esc_attr__('True', 'simple-tags'), |
| 1464 |
'default' => 'true', |
| 1465 |
], |
| 1466 |
], |
| 1467 |
]; |
| 1468 |
$selected = isset($current) ? taxopress_disp_boolean($current['query_var']) : ''; |
| 1469 |
$select['selected'] = !empty($selected) ? $current['query_var'] : ''; |
| 1470 |
echo $ui->get_select_checkbox_input([ |
| 1471 |
'namearray' => 'cpt_custom_tax', |
| 1472 |
'name' => 'query_var', |
| 1473 |
'labeltext' => esc_html__('Query Var', 'simple-tags'), |
| 1474 |
'aftertext' => esc_html__('Enable a custom query_var key for this taxonomy.', |
| 1475 |
'simple-tags'), |
| 1476 |
'selections' => $select, |
| 1477 |
]); |
| 1478 |
|
| 1479 |
echo $ui->get_text_input([ |
| 1480 |
'namearray' => 'cpt_custom_tax', |
| 1481 |
'name' => 'query_var_slug', |
| 1482 |
'textvalue' => isset($current['query_var_slug']) ? esc_attr($current['query_var_slug']) : '', |
| 1483 |
'aftertext' => '', |
| 1484 |
'labeltext' => esc_html__('Custom Query Var String', 'simple-tags'), |
| 1485 |
'helptext' => esc_html__('Sets a custom query_var slug for this taxonomy.', |
| 1486 |
'simple-tags'), |
| 1487 |
]); |
| 1488 |
|
| 1489 |
echo $ui->get_text_input([ |
| 1490 |
'namearray' => 'cpt_custom_tax', |
| 1491 |
'name' => 'meta_box_cb', |
| 1492 |
'textvalue' => isset($current['meta_box_cb']) ? esc_attr($current['meta_box_cb']) : '', |
| 1493 |
'labeltext' => esc_html__('Metabox callback', 'simple-tags'), |
| 1494 |
'helptext' => esc_html__('Sets a callback function name for the meta box display. Hierarchical default: post_categories_meta_box, non-hierarchical default: post_tags_meta_box. To remove the metabox completely, use "false".', |
| 1495 |
'simple-tags'), |
| 1496 |
]); |
| 1497 |
|
| 1498 |
echo $ui->get_text_input([ |
| 1499 |
'namearray' => 'cpt_custom_tax', |
| 1500 |
'name' => 'default_term', |
| 1501 |
'textvalue' => isset($current['default_term']) ? esc_attr($current['default_term']) : '', |
| 1502 |
'labeltext' => esc_html__('Default Term', 'simple-tags'), |
| 1503 |
'helptext' => esc_html__('Set a default term for the taxonomy. Able to set a name, slug, and description. Only a name is required if setting a default, others are optional. Set values in the following order, separated by comma. Example: name, slug, description', |
| 1504 |
'simple-tags'), |
| 1505 |
]); |
| 1506 |
?> |
| 1507 |
</table> |
| 1508 |
|
| 1509 |
|
| 1510 |
<table class="form-table taxopress-table taxonomy_delete" |
| 1511 |
style="display:none;"> |
| 1512 |
<?php |
| 1513 |
echo $ui->get_tr_start() . $ui->get_th_start(); |
| 1514 |
|
| 1515 |
?> |
| 1516 |
<?php |
| 1517 |
if (!empty($_GET) && !empty($_GET['action']) && 'edit' === $_GET['action']) { ?> |
| 1518 |
|
| 1519 |
|
| 1520 |
<?php |
| 1521 |
|
| 1522 |
$activate_action_link = add_query_arg( |
| 1523 |
[ |
| 1524 |
'page' => 'st_taxonomies', |
| 1525 |
'add' => 'taxonomy', |
| 1526 |
'action' => 'edit', |
| 1527 |
'action2' => 'taxopress-reactivate-taxonomy', |
| 1528 |
'taxonomy' => esc_attr($request_tax), |
| 1529 |
'_wpnonce' => wp_create_nonce('taxonomy-action-request-nonce'), |
| 1530 |
'taxopress_taxonomy' => $request_tax, |
| 1531 |
], |
| 1532 |
taxopress_admin_url('admin.php') |
| 1533 |
); |
| 1534 |
$deactivate_action_link = add_query_arg( |
| 1535 |
[ |
| 1536 |
'page' => 'st_taxonomies', |
| 1537 |
'add' => 'taxonomy', |
| 1538 |
'action' => 'edit', |
| 1539 |
'action2' => 'taxopress-deactivate-taxonomy', |
| 1540 |
'taxonomy' => esc_attr($request_tax), |
| 1541 |
'_wpnonce' => wp_create_nonce('taxonomy-action-request-nonce'), |
| 1542 |
'taxopress_taxonomy' => $request_tax, |
| 1543 |
], |
| 1544 |
taxopress_admin_url('admin.php') |
| 1545 |
); |
| 1546 |
|
| 1547 |
if (in_array($request_tax, taxopress_get_deactivated_taxonomy())) { |
| 1548 |
?> |
| 1549 |
<span class="action-button reactivate"><a class="button-primary" |
| 1550 |
href="<?php echo $activate_action_link; ?>"><?php echo __('Re-activate Taxonomy', |
| 1551 |
'simple-tags'); ?></a></span> |
| 1552 |
<?php } else { ?> |
| 1553 |
<span class="action-button deactivate"><a class="button-primary" |
| 1554 |
href="<?php echo $deactivate_action_link; ?>"><?php echo __('Deactivate Taxonomy', |
| 1555 |
'simple-tags'); ?></a></span> |
| 1556 |
<?php } |
| 1557 |
/** |
| 1558 |
* Filters the text value to use on the button when deleting. |
| 1559 |
* |
| 1560 |
* @param string $value Text to use for the button. |
| 1561 |
*/ |
| 1562 |
if (!$external_edit) { |
| 1563 |
?> |
| 1564 |
<input type="submit" class="button-secondary taxopress-delete-bottom" |
| 1565 |
name="cpt_delete" |
| 1566 |
id="cpt_submit_delete" |
| 1567 |
value="<?php echo esc_attr(apply_filters('taxopress_taxonomy_submit_delete', |
| 1568 |
__('Delete Taxonomy', 'simple-tags'))); ?>"/> |
| 1569 |
<?php }else{ |
| 1570 |
echo '<div class="taxopress-warning" style="color:red;">' . __('You can only delete taxonomies created with TaxoPress.', |
| 1571 |
'simple-tags') . '</div>'; |
| 1572 |
} |
| 1573 |
} |
| 1574 |
?> |
| 1575 |
|
| 1576 |
<?php |
| 1577 |
|
| 1578 |
echo $ui->get_th_end(). $ui->get_tr_end(); |
| 1579 |
|
| 1580 |
|
| 1581 |
?> |
| 1582 |
|
| 1583 |
</table> |
| 1584 |
|
| 1585 |
|
| 1586 |
</div> |
| 1587 |
<div class="clear"></div> |
| 1588 |
|
| 1589 |
|
| 1590 |
</div> |
| 1591 |
</div> |
| 1592 |
</div> |
| 1593 |
|
| 1594 |
|
| 1595 |
<?php |
| 1596 |
/** |
| 1597 |
* Fires after the default fieldsets on the taxonomy screen. |
| 1598 |
* |
| 1599 |
* @param taxopress_admin_ui $ui Admin UI instance. |
| 1600 |
*/ |
| 1601 |
do_action('taxopress_taxonomy_after_fieldsets', $ui); |
| 1602 |
?> |
| 1603 |
|
| 1604 |
</div> |
| 1605 |
</div> |
| 1606 |
</form> |
| 1607 |
</div><!-- End .wrap --> |
| 1608 |
|
| 1609 |
<div class="clear"></div> |
| 1610 |
|
| 1611 |
<?php # Modal Windows; ?> |
| 1612 |
<div class="remodal" data-remodal-id="taxopress-modal-alert" |
| 1613 |
data-remodal-options="hashTracking: false, closeOnOutsideClick: false"> |
| 1614 |
<div class="" style="color:red;"><?php echo __('Please complete the following required fields to save your changes:', 'simple-tags'); ?></div> |
| 1615 |
<div id="taxopress-modal-alert-content"></div> |
| 1616 |
<br> |
| 1617 |
<button data-remodal-action="cancel" class="remodal-cancel"><?php echo __('Okay', 'simple-tags'); ?></button> |
| 1618 |
</div> |
| 1619 |
|
| 1620 |
<div class="remodal" data-remodal-id="taxopress-modal-confirm" |
| 1621 |
data-remodal-options="hashTracking: false, closeOnOutsideClick: false"> |
| 1622 |
<div id="taxopress-modal-confirm-content"></div> |
| 1623 |
<br> |
| 1624 |
<button data-remodal-action="cancel" class="remodal-cancel"><?php echo __('No', 'simple-tags'); ?></button> |
| 1625 |
<button data-remodal-action="confirm" |
| 1626 |
class="remodal-confirm"><?php echo __('Yes', 'simple-tags'); ?></button> |
| 1627 |
</div> |
| 1628 |
|
| 1629 |
<?php |
| 1630 |
} |
| 1631 |
|
| 1632 |
} |
| 1633 |
|