WordPress.org

Make WordPress Core

Changeset 9550


Ignore:
Timestamp:
11/06/2008 05:18:38 PM (10 years ago)
Author:
ryan
Message:

Use wp_dropdown_categories(). Props DD32. fixes #8075

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/options-writing.php

    r9390 r9550  
    4141<tr valign="top">
    4242<th scope="row"><label for="default_category"><?php _e('Default Post Category') ?></label></th>
    43 <td><select name="default_category" id="default_category">
     43<td>
    4444<?php
    45 $categories = get_categories('get=all');
    46 foreach ($categories as $category) :
    47 $category = sanitize_category($category);
    48 if ($category->term_id == get_option('default_category')) $selected = " selected='selected'";
    49 else $selected = '';
    50 echo "\n\t<option value='$category->term_id' $selected>$category->name</option>";
    51 endforeach;
     45wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_category', 'orderby' => 'name', 'selected' => get_option('default_category'), 'hierarchical' => true));
    5246?>
    53 </select></td>
     47</td>
    5448</tr>
    5549<tr valign="top">
    5650<th scope="row"><label for="default_link_category"><?php _e('Default Link Category') ?></label></th>
    57 <td><select name="default_link_category" id="default_link_category">
     51<td>
    5852<?php
    59 $link_categories = get_terms('link_category', 'get=all');
    60 foreach ($link_categories as $category) :
    61 $category = sanitize_term($category, 'link_category');
    62 if ($category->term_id == get_option('default_link_category')) $selected = " selected='selected'";
    63 else $selected = '';
    64 echo "\n\t<option value='$category->term_id' $selected>$category->name</option>";
    65 endforeach;
     53wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_link_category', 'orderby' => 'name', 'selected' => get_option('default_link_category'), 'hierarchical' => true, 'type' => 'link'));
    6654?>
    67 </select></td>
     55</td>
    6856</tr>
    6957<?php do_settings_fields('writing', 'default'); ?>
     
    115103<tr valign="top">
    116104<th scope="row"><label for="default_email_category"><?php _e('Default Mail Category') ?></label></th>
    117 <td><select name="default_email_category" id="default_email_category">
     105<td>
    118106<?php
    119 //Alreay have $categories from default_category
    120 foreach ($categories as $category) :
    121 $category = sanitize_category($category);
    122 if ($category->cat_ID == get_option('default_email_category')) $selected = " selected='selected'";
    123 else $selected = '';
    124 echo "\n\t<option value='$category->cat_ID' $selected>$category->cat_name</option>";
    125 endforeach;
     107wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_email_category', 'orderby' => 'name', 'selected' => get_option('default_email_category'), 'hierarchical' => true));
    126108?>
    127 </select></td>
     109</td>
    128110</tr>
    129111<?php do_settings_fields('writing', 'post_via_email'); ?>
Note: See TracChangeset for help on using the changeset viewer.