3 * Edit link category form for inclusion in administration panels.
6 * @subpackage Administration
10 if ( !defined('ABSPATH') )
13 if ( !current_user_can('manage_categories') )
14 wp_die(__('You do not have sufficient permissions to edit link categories for this blog.'));
19 if ( ! isset( $category ) )
20 $category = (object) array();
22 if ( ! empty($cat_ID) ) {
26 $heading = '<h2>' . __('Edit Link Category') . '</h2>';
27 $submit_text = __('Update Category');
28 $form = '<form name="editcat" id="editcat" method="post" action="link-category.php" class="validate">';
29 $action = 'editedcat';
30 $nonce_action = 'update-link-category_' . $cat_ID;
31 do_action('edit_link_category_form_pre', $category);
33 $heading = '<h2>' . __('Add Link Category') . '</h2>';
34 $submit_text = __('Add Category');
35 $form = '<form name="addcat" id="addcat" class="add:the-list: validate" method="post" action="link-category.php">';
37 $nonce_action = 'add-link-category';
38 do_action('add_link_category_form_pre', $category);
44 * @internal Used to prevent errors in page when no category is being edited.
46 * @param object $category
48 function _fill_empty_link_category(&$category) {
49 if ( ! isset( $category->name ) )
52 if ( ! isset( $category->slug ) )
55 if ( ! isset( $category->description ) )
56 $category->description = '';
59 _fill_empty_link_category($category);
63 <?php screen_icon(); ?>
64 <?php echo $heading ?>
65 <div id="ajax-response"></div>
67 <input type="hidden" name="action" value="<?php echo esc_attr($action) ?>" />
68 <input type="hidden" name="cat_ID" value="<?php echo esc_attr($category->term_id) ?>" />
69 <?php wp_original_referer_field(true, 'previous'); wp_nonce_field($nonce_action); ?>
70 <table class="form-table">
71 <tr class="form-field form-required">
72 <th scope="row" valign="top"><label for="name"><?php _e('Link Category name') ?></label></th>
73 <td><input name="name" id="name" type="text" value="<?php echo esc_attr($category->name); ?>" size="40" aria-required="true" /></td>
75 <tr class="form-field">
76 <th scope="row" valign="top"><label for="slug"><?php _e('Link Category slug') ?></label></th>
77 <td><input name="slug" id="slug" type="text" value="<?php echo esc_attr(apply_filters('editable_slug', $category->slug)); ?>" size="40" /><br />
78 <?php _e('The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></td>
80 <tr class="form-field">
81 <th scope="row" valign="top"><label for="description"><?php _e('Description (optional)') ?></label></th>
82 <td><textarea name="description" id="description" rows="5" cols="50" style="width: 97%;"><?php echo $category->description; ?></textarea><br />
83 <span class="description"><?php _e('The description is not prominent by default; however, some themes may show it.'); ?></span></td>
85 <?php do_action('edit_link_category_form_fields', $category); ?>
87 <p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php echo esc_attr($submit_text) ?>" /></p>
88 <?php do_action('edit_link_category_form', $category); ?>