Add optional post ID arg to the_category and get_the_category_list. Props filosofo. fixes #5050
git-svn-id: http://svn.automattic.com/wordpress/trunk@6899 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ffe43e781e
commit
1ba0025c60
|
@ -109,9 +109,9 @@ function get_the_category_by_ID($cat_ID) {
|
|||
return $category->name;
|
||||
}
|
||||
|
||||
function get_the_category_list($separator = '', $parents='') {
|
||||
function get_the_category_list($separator = '', $parents='', $post_id = false) {
|
||||
global $wp_rewrite;
|
||||
$categories = get_the_category();
|
||||
$categories = get_the_category($post_id);
|
||||
if (empty($categories))
|
||||
return apply_filters('the_category', __('Uncategorized'), $separator, $parents);
|
||||
|
||||
|
@ -179,8 +179,8 @@ function in_category( $category ) { // Check if the current post is in the given
|
|||
return false;
|
||||
}
|
||||
|
||||
function the_category($separator = '', $parents='') {
|
||||
echo get_the_category_list($separator, $parents);
|
||||
function the_category($separator = '', $parents='', $post_id = false) {
|
||||
echo get_the_category_list($separator, $parents, $post_id);
|
||||
}
|
||||
|
||||
function category_description($category = 0) {
|
||||
|
|
Loading…
Reference in New Issue