Use wp_dropdown_categories(). Fix padding. Don't allow a cat to be it's own parent. Props westi. fixes #3088
git-svn-id: http://svn.automattic.com/wordpress/trunk@4156 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
202c2067b4
commit
02ad124b46
|
@ -108,7 +108,7 @@ function wp_insert_category($catarr) {
|
|||
$category_description = apply_filters('pre_category_description', $category_description);
|
||||
|
||||
$category_parent = (int) $category_parent;
|
||||
if ( empty($category_parent) || !get_category( $category_parent ) )
|
||||
if ( empty($category_parent) || !get_category( $category_parent ) || $category_parent == $cat_ID )
|
||||
$category_parent = 0;
|
||||
|
||||
if ( isset($posts_private) )
|
||||
|
|
|
@ -32,10 +32,8 @@ if ( ! empty($cat_ID) ) {
|
|||
<tr>
|
||||
<th scope="row" valign="top"><label for="category_parent"><?php _e('Category parent:') ?></label></th>
|
||||
<td>
|
||||
<select name='category_parent' id='category_parent'>
|
||||
<option value='0' <?php if (!$category->category_parent) echo " selected='selected'"; ?>><?php _e('None') ?></option>
|
||||
<?php wp_dropdown_cats($category->cat_ID, $category->category_parent); ?>
|
||||
</select></td>
|
||||
<?php wp_dropdown_categories('hide_empty=0&name=category_parent&selected=' . $category->category_parent . '&hierarchical=1&show_option_none=' . __('None')); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row" valign="top"><label for="category_description"><?php _e('Description: (optional)') ?></label></th>
|
||||
|
|
|
@ -696,7 +696,7 @@ class Walker_CategoryDropdown extends Walker {
|
|||
if ( $category->cat_ID == $args['selected'] )
|
||||
$output .= ' selected="selected"';
|
||||
$output .= '>';
|
||||
$output .= $cat_name;
|
||||
$output .= $pad.$cat_name;
|
||||
if ( $args['show_count'] )
|
||||
$output .= ' ('. $category->category_count .')';
|
||||
if ( $args['show_last_update'] ) {
|
||||
|
|
Loading…
Reference in New Issue