Make WordPress Core

Changeset 5642


Ignore:
Timestamp:
06/03/2007 05:28:27 PM (17 years ago)
Author:
ryan
Message:

Fix link category dropdown and filter. Add some back compat to get_categories. see #4189

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/link-manager.php

    r5523 r5642  
    7777<form id="cats" method="get" action="">
    7878<p><?php
    79 $categories = get_categories("hide_empty=1&type=link");
     79$categories = get_terms('link_category', "hide_empty=1");
    8080$select_cat = "<select name=\"cat_id\">\n";
    8181$select_cat .= '<option value="all"'  . (($cat_id == 'all') ? " selected='selected'" : '') . '>' . __('All') . "</option>\n";
    8282foreach ((array) $categories as $cat)
    83     $select_cat .= '<option value="' . $cat->cat_ID . '"' . (($cat->cat_ID == $cat_id) ? " selected='selected'" : '') . '>' . wp_specialchars(apply_filters('link_category', $cat->cat_name)) . "</option>\n";
     83    $select_cat .= '<option value="' . $cat->term_id . '"' . (($cat->term_id == $cat_id) ? " selected='selected'" : '') . '>' . wp_specialchars(apply_filters('link_category', $cat->name)) . "</option>\n";
    8484$select_cat .= "</select>\n";
    8585
  • trunk/wp-includes/category.php

    r5599 r5642  
    1313
    1414function &get_categories($args = '') {
    15     // TODO Add back compat fields into each object.
    16     // Set taxonomy to link_category if type=link
    17     return get_terms('category', $args);
     15    $defaults = array('type' => 'category');
     16    $args = wp_parse_args($args, $defaults);
     17
     18    $taxonomy = 'category';
     19    if ( 'link' == $args['type'] )
     20        $taxonomy = 'link_category';
     21    return get_terms($taxonomy, $args);
    1822}
    1923
Note: See TracChangeset for help on using the changeset viewer.