mp-wp_genesis 1 <?php
mp-wp_genesis 2 /**
mp-wp_genesis 3 * Edit category form for inclusion in administration panels.
mp-wp_genesis 4 *
mp-wp_genesis 5 * @package WordPress
mp-wp_genesis 6 * @subpackage Administration
mp-wp_genesis 7 */
mp-wp_genesis 8
mp-wp_genesis 9 /**
mp-wp_genesis 10 * @var object
mp-wp_genesis 11 */
mp-wp_genesis 12 if ( ! isset( $category ) )
mp-wp_genesis 13 $category = (object) array();
mp-wp_genesis 14
mp-wp_genesis 15 /**
mp-wp_genesis 16 * @ignore
mp-wp_genesis 17 * @since 2.7
mp-wp_genesis 18 * @internal Used to prevent errors in page when no category is being edited.
mp-wp_genesis 19 *
mp-wp_genesis 20 * @param object $category
mp-wp_genesis 21 */
mp-wp_genesis 22 function _fill_empty_category(&$category) {
mp-wp_genesis 23 if ( ! isset( $category->name ) )
mp-wp_genesis 24 $category->name = '';
mp-wp_genesis 25
mp-wp_genesis 26 if ( ! isset( $category->slug ) )
mp-wp_genesis 27 $category->slug = '';
mp-wp_genesis 28
mp-wp_genesis 29 if ( ! isset( $category->parent ) )
mp-wp_genesis 30 $category->parent = '';
mp-wp_genesis 31
mp-wp_genesis 32 if ( ! isset( $category->description ) )
mp-wp_genesis 33 $category->description = '';
mp-wp_genesis 34 }
mp-wp_genesis 35
mp-wp_genesis 36 do_action('edit_category_form_pre', $category);
mp-wp_genesis 37
mp-wp_genesis 38 _fill_empty_category($category);
mp-wp_genesis 39 ?>
mp-wp_genesis 40
mp-wp_genesis 41 <div class="wrap">
mp-wp_genesis 42 <?php screen_icon(); ?>
mp-wp_genesis 43 <h2><?php _e('Edit Category'); ?></h2>
mp-wp_genesis 44 <form name="editcat" id="editcat" method="post" action="categories.php" class="validate">
mp-wp_genesis 45 <input type="hidden" name="action" value="editedcat" />
mp-wp_genesis 46 <input type="hidden" name="cat_ID" value="<?php echo $category->term_id ?>" />
mp-wp_genesis 47 <?php wp_original_referer_field(true, 'previous'); wp_nonce_field('update-category_' . $cat_ID); ?>
mp-wp_genesis 48 <table class="form-table">
mp-wp_genesis 49 <tr class="form-field form-required">
mp-wp_genesis 50 <th scope="row" valign="top"><label for="cat_name"><?php _e('Category Name') ?></label></th>
mp-wp_genesis 51 <td><input name="cat_name" id="cat_name" type="text" value="<?php echo attribute_escape($category->name); ?>" size="40" aria-required="true" /><br />
mp-wp_genesis 52 <?php _e('The name is used to identify the category almost everywhere, for example under the post or in the category widget.'); ?></td>
mp-wp_genesis 53 </tr>
mp-wp_genesis 54 <tr class="form-field">
mp-wp_genesis 55 <th scope="row" valign="top"><label for="category_nicename"><?php _e('Category Slug') ?></label></th>
mp-wp_genesis 56 <td><input name="category_nicename" id="category_nicename" type="text" value="<?php echo attribute_escape(apply_filters('editable_slug', $category->slug)); ?>" size="40" /><br />
mp-wp_genesis 57 <?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>
mp-wp_genesis 58 </tr>
mp-wp_genesis 59 <tr class="form-field">
mp-wp_genesis 60 <th scope="row" valign="top"><label for="category_parent"><?php _e('Category Parent') ?></label></th>
mp-wp_genesis 61 <td>
mp-wp_genesis 62 <?php wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'category_parent', 'orderby' => 'name', 'selected' => $category->parent, 'hierarchical' => true, 'show_option_none' => __('None'))); ?><br />
mp-wp_genesis 63 <?php _e('Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.'); ?>
mp-wp_genesis 64 </td>
mp-wp_genesis 65 </tr>
mp-wp_genesis 66 <tr class="form-field">
mp-wp_genesis 67 <th scope="row" valign="top"><label for="category_description"><?php _e('Description') ?></label></th>
mp-wp_genesis 68 <td><textarea name="category_description" id="category_description" rows="5" cols="50" style="width: 97%;"><?php echo wp_specialchars($category->description); ?></textarea><br />
mp-wp_genesis 69 <?php _e('The description is not prominent by default, however some themes may show it.'); ?></td>
mp-wp_genesis 70 </tr>
mp-wp_genesis 71 </table>
mp-wp_genesis 72 <p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php _e('Update Category'); ?>" /></p>
mp-wp_genesis 73 <?php do_action('edit_category_form', $category); ?>
mp-wp_genesis 74 </form>
mp-wp_genesis 75 </div>