| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
if ( ! isset( $category ) ) |
|---|
| 13 |
$category = (object) array(); |
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
function _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 |
|
|---|
| 36 |
do_action('edit_category_form_pre', $category); |
|---|
| 37 |
|
|---|
| 38 |
_fill_empty_category($category); |
|---|
| 39 |
?> |
|---|
| 40 |
|
|---|
| 41 |
<div class="wrap"> |
|---|
| 42 |
<h2><?php _e('Edit Category'); ?></h2> |
|---|
| 43 |
<div id="ajax-response"></div> |
|---|
| 44 |
<form name="editcat" id="editcat" method="post" action="categories.php" class="validate"> |
|---|
| 45 |
<input type="hidden" name="action" value="editedcat" /> |
|---|
| 46 |
<input type="hidden" name="cat_ID" value="<?php echo $category->term_id ?>" /> |
|---|
| 47 |
<?php wp_original_referer_field(true, 'previous'); wp_nonce_field('update-category_' . $cat_ID); ?> |
|---|
| 48 |
<table class="form-table"> |
|---|
| 49 |
<tr class="form-field form-required"> |
|---|
| 50 |
<th scope="row" valign="top"><label for="cat_name"><?php _e('Category Name') ?></label></th> |
|---|
| 51 |
<td><input name="cat_name" id="cat_name" type="text" value="<?php echo attribute_escape($category->name); ?>" size="40" aria-required="true" /><br /> |
|---|
| 52 |
<?php _e('The name is used to identify the category almost everywhere, for example under the post or in the category widget.'); ?></td> |
|---|
| 53 |
</tr> |
|---|
| 54 |
<tr class="form-field"> |
|---|
| 55 |
<th scope="row" valign="top"><label for="category_parent"><?php _e('Category Parent') ?></label></th> |
|---|
| 56 |
<td> |
|---|
| 57 |
<?php wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'category_parent', 'orderby' => 'name', 'selected' => $category->parent, 'hierarchical' => true, 'show_option_none' => __('None'))); ?><br /> |
|---|
| 58 |
<?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.'); ?> |
|---|
| 59 |
</td> |
|---|
| 60 |
</tr> |
|---|
| 61 |
<tr class="form-field"> |
|---|
| 62 |
<th scope="row" valign="top"><label for="category_description"><?php _e('Description') ?></label></th> |
|---|
| 63 |
<td><textarea name="category_description" id="category_description" rows="5" cols="50" style="width: 97%;"><?php echo wp_specialchars($category->description); ?></textarea><br /> |
|---|
| 64 |
<?php _e('The description is not prominent by default, however some themes may show it.'); ?></td> |
|---|
| 65 |
</tr> |
|---|
| 66 |
</table> |
|---|
| 67 |
<p class="submit"><input type="submit" class="button" name="submit" value="<?php _e('Edit Category'); ?>" /></p> |
|---|
| 68 |
<?php do_action('edit_category_form', $category); ?> |
|---|
| 69 |
</form> |
|---|
| 70 |
</div> |
|---|
| 71 |
|
|---|