Fix link category dropdown and filter. Add some back compat to get_categories. see #4189
git-svn-id: http://svn.automattic.com/wordpress/trunk@5642 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
bf88d4adc0
commit
16e8f842f5
|
@ -76,11 +76,11 @@ if ( isset($_GET['deleted']) ) {
|
|||
<p><?php _e('Here you <a href="link-add.php">add links</a> to sites that you visit often and share them on your blog. When you have a list of links in your sidebar to other blogs, it’s called a “blogroll.”'); ?></p>
|
||||
<form id="cats" method="get" action="">
|
||||
<p><?php
|
||||
$categories = get_categories("hide_empty=1&type=link");
|
||||
$categories = get_terms('link_category', "hide_empty=1");
|
||||
$select_cat = "<select name=\"cat_id\">\n";
|
||||
$select_cat .= '<option value="all"' . (($cat_id == 'all') ? " selected='selected'" : '') . '>' . __('All') . "</option>\n";
|
||||
foreach ((array) $categories as $cat)
|
||||
$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";
|
||||
$select_cat .= '<option value="' . $cat->term_id . '"' . (($cat->term_id == $cat_id) ? " selected='selected'" : '') . '>' . wp_specialchars(apply_filters('link_category', $cat->name)) . "</option>\n";
|
||||
$select_cat .= "</select>\n";
|
||||
|
||||
$select_order = "<select name=\"order_by\">\n";
|
||||
|
|
|
@ -12,9 +12,13 @@ function get_all_category_ids() {
|
|||
}
|
||||
|
||||
function &get_categories($args = '') {
|
||||
// TODO Add back compat fields into each object.
|
||||
// Set taxonomy to link_category if type=link
|
||||
return get_terms('category', $args);
|
||||
$defaults = array('type' => 'category');
|
||||
$args = wp_parse_args($args, $defaults);
|
||||
|
||||
$taxonomy = 'category';
|
||||
if ( 'link' == $args['type'] )
|
||||
$taxonomy = 'link_category';
|
||||
return get_terms($taxonomy, $args);
|
||||
}
|
||||
|
||||
// Retrieves category data given a category ID or category object.
|
||||
|
|
Loading…
Reference in New Issue