Fix default cat options. see #4189

git-svn-id: http://svn.automattic.com/wordpress/trunk@5562 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2007-05-27 17:57:15 +00:00
parent 333d77ea9c
commit 2857b43d78

View File

@ -31,11 +31,11 @@ include('admin-header.php');
<th scope="row"><?php _e('Default post category:') ?></th> <th scope="row"><?php _e('Default post category:') ?></th>
<td><select name="default_category" id="default_category"> <td><select name="default_category" id="default_category">
<?php <?php
$categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_name"); $categories = get_categories('get=all');
foreach ($categories as $category) : foreach ($categories as $category) :
if ($category->cat_ID == get_option('default_category')) $selected = " selected='selected'"; if ($category->term_id == get_option('default_category')) $selected = " selected='selected'";
else $selected = ''; else $selected = '';
echo "\n\t<option value='$category->cat_ID' $selected>$category->cat_name</option>"; echo "\n\t<option value='$category->term_id' $selected>$category->name</option>";
endforeach; endforeach;
?> ?>
</select></td> </select></td>
@ -44,10 +44,11 @@ endforeach;
<th scope="row"><?php _e('Default link category:') ?></th> <th scope="row"><?php _e('Default link category:') ?></th>
<td><select name="default_link_category" id="default_link_category"> <td><select name="default_link_category" id="default_link_category">
<?php <?php
$categories = get_terms('link_category', 'get=all');
foreach ($categories as $category) : foreach ($categories as $category) :
if ($category->cat_ID == get_option('default_link_category')) $selected = " selected='selected'"; if ($category->term_id == get_option('default_link_category')) $selected = " selected='selected'";
else $selected = ''; else $selected = '';
echo "\n\t<option value='$category->cat_ID' $selected>$category->cat_name</option>"; echo "\n\t<option value='$category->term_id' $selected>$category->name</option>";
endforeach; endforeach;
?> ?>
</select></td> </select></td>