Use get_term_children() and get_term_field(). see #4189
git-svn-id: https://develop.svn.wordpress.org/trunk@5660 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
4feb85438d
commit
e1ef29586c
@ -172,8 +172,8 @@ function category_description($category = 0) {
|
||||
global $cat;
|
||||
if ( !$category )
|
||||
$category = $cat;
|
||||
$category = & get_category($category);
|
||||
return apply_filters('category_description', $category->description, $category->term_id);
|
||||
|
||||
return get_term_field('description', $category, 'category');
|
||||
}
|
||||
|
||||
function wp_dropdown_categories($args = '') {
|
||||
|
@ -915,15 +915,13 @@ class WP_Query {
|
||||
|
||||
$join = " LEFT JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) ";
|
||||
$whichcat = " AND $wpdb->term_taxonomy.taxonomy = 'category' ";
|
||||
$whichcat .= "AND $wpdb->term_taxonomy.term_id IN ({$q['cat']}, ";
|
||||
$whichcat .= get_category_children($q['cat'], '', ', ');
|
||||
$whichcat = substr($whichcat, 0, -2);
|
||||
$whichcat .= ")";
|
||||
$in_cats = array($q['cat']);
|
||||
$in_cats = array_merge($in_cats, get_term_children($q['cat'], 'category'));
|
||||
$in_cats = "'" . implode("', '", $in_cats) . "'";
|
||||
$whichcat .= "AND $wpdb->term_taxonomy.term_id IN ($in_cats)";
|
||||
$groupby = "{$wpdb->posts}.ID";
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Author/user stuff
|
||||
|
||||
if ( empty($q['author']) || ($q['author'] == '0') ) {
|
||||
|
Loading…
Reference in New Issue
Block a user