source: trunk/www.guidonia.net/wp/wp-admin/edit-category-form.php@ 44

Last change on this file since 44 was 44, checked in by luciano, 15 years ago
File size: 3.5 KB
Line 
1<?php
2/**
3 * Edit category form for inclusion in administration panels.
4 *
5 * @package WordPress
6 * @subpackage Administration
7 */
8
9/**
10 * @var object
11 */
12if ( ! isset( $category ) )
13 $category = (object) array();
14
15/**
16 * @ignore
17 * @since 2.7
18 * @internal Used to prevent errors in page when no category is being edited.
19 *
20 * @param object $category
21 */
22function _fill_empty_category(&$category) {
23 if ( ! isset( $category->name ) )
24 $category->name = '';
25
26 if ( ! isset( $category->slug ) )
27 $category->slug = '';
28
29 if ( ! isset( $category->parent ) )
30 $category->parent = '';
31
32 if ( ! isset( $category->description ) )
33 $category->description = '';
34}
35
36do_action('edit_category_form_pre', $category);
37
38_fill_empty_category($category);
39?>
40
41<div class="wrap">
42<?php screen_icon(); ?>
43<h2><?php _e('Edit Category'); ?></h2>
44<div id="ajax-response"></div>
45<form name="editcat" id="editcat" method="post" action="categories.php" class="validate">
46<input type="hidden" name="action" value="editedcat" />
47<input type="hidden" name="cat_ID" value="<?php echo esc_attr($category->term_id) ?>" />
48<?php wp_original_referer_field(true, 'previous'); wp_nonce_field('update-category_' . $cat_ID); ?>
49 <table class="form-table">
50 <tr class="form-field form-required">
51 <th scope="row" valign="top"><label for="cat_name"><?php _e('Category Name') ?></label></th>
52 <td><input name="cat_name" id="cat_name" type="text" value="<?php echo esc_attr($category->name); ?>" size="40" aria-required="true" /><br />
53 <span class="description"><?php _e('The name is used to identify the category almost everywhere, for example under the post or in the category widget.'); ?></span></td>
54 </tr>
55 <tr class="form-field">
56 <th scope="row" valign="top"><label for="category_nicename"><?php _e('Category Slug') ?></label></th>
57 <td><input name="category_nicename" id="category_nicename" type="text" value="<?php echo esc_attr(apply_filters('editable_slug', $category->slug)); ?>" size="40" /><br />
58 <span class="description"><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></span></td>
59 </tr>
60 <tr class="form-field">
61 <th scope="row" valign="top"><label for="category_parent"><?php _e('Category Parent') ?></label></th>
62 <td>
63 <?php wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'category_parent', 'orderby' => 'name', 'selected' => $category->parent, 'hierarchical' => true, 'show_option_none' => __('None'))); ?><br />
64 <span class="description"><?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.'); ?></span>
65 </td>
66 </tr>
67 <tr class="form-field">
68 <th scope="row" valign="top"><label for="category_description"><?php _e('Description') ?></label></th>
69 <td><textarea name="category_description" id="category_description" rows="5" cols="50" style="width: 97%;"><?php echo esc_html($category->description); ?></textarea><br />
70 <span class="description"><?php _e('The description is not prominent by default, however some themes may show it.'); ?></span></td>
71 </tr>
72 <?php do_action('edit_category_form_fields', $category); ?>
73 </table>
74<p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php esc_attr_e('Update Category'); ?>" /></p>
75<?php do_action('edit_category_form', $category); ?>
76</form>
77</div>
Note: See TracBrowser for help on using the repository browser.