3 * Edit link category form for inclusion in administration panels.
6 * @subpackage Administration
12 if ( ! isset( $category ) )
13 $category = (object) array();
15 if ( ! empty($cat_ID) ) {
19 $heading = '<h2>' . __('Edit Link Category') . '</h2>';
20 $submit_text = __('Update Category');
21 $form = '<form name="editcat" id="editcat" method="post" action="link-category.php" class="validate">';
22 $action = 'editedcat';
23 $nonce_action = 'update-link-category_' . $cat_ID;
24 do_action('edit_link_category_form_pre', $category);
26 $heading = '<h2>' . __('Add Link Category') . '</h2>';
27 $submit_text = __('Add Category');
28 $form = '<form name="addcat" id="addcat" class="add:the-list: validate" method="post" action="link-category.php">';
30 $nonce_action = 'add-link-category';
31 do_action('add_link_category_form_pre', $category);
37 * @internal Used to prevent errors in page when no category is being edited.
39 * @param object $category
41 function _fill_empty_link_category(&$category) {
42 if ( ! isset( $category->name ) )
45 if ( ! isset( $category->slug ) )
48 if ( ! isset( $category->description ) )
49 $category->description = '';
52 _fill_empty_link_category($category);
56 <?php screen_icon(); ?>
57 <?php echo $heading ?>
58 <div id="ajax-response"></div>
60 <input type="hidden" name="action" value="<?php echo esc_attr($action) ?>" />
61 <input type="hidden" name="cat_ID" value="<?php echo esc_attr($category->term_id) ?>" />
62 <?php wp_original_referer_field(true, 'previous'); wp_nonce_field($nonce_action); ?>
63 <table class="form-table">
64 <tr class="form-field form-required">
65 <th scope="row" valign="top"><label for="name"><?php _e('Link Category name') ?></label></th>
66 <td><input name="name" id="name" type="text" value="<?php echo esc_attr($category->name); ?>" size="40" aria-required="true" /></td>
68 <tr class="form-field">
69 <th scope="row" valign="top"><label for="slug"><?php _e('Link Category slug') ?></label></th>
70 <td><input name="slug" id="slug" type="text" value="<?php echo esc_attr(apply_filters('editable_slug', $category->slug)); ?>" size="40" /><br />
71 <?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>
73 <tr class="form-field">
74 <th scope="row" valign="top"><label for="description"><?php _e('Description (optional)') ?></label></th>
75 <td><textarea name="description" id="description" rows="5" cols="50" style="width: 97%;"><?php echo $category->description; ?></textarea></td>
78 <p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php echo esc_attr($submit_text) ?>" /></p>
79 <?php do_action('edit_link_category_form', $category); ?>