mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 21:00:21 +00:00
Tag descriptions, props aaroncampbell, fixes #9381
git-svn-id: https://develop.svn.wordpress.org/trunk@10903 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -293,11 +293,7 @@ function the_category( $separator = '', $parents='', $post_id = false ) {
|
||||
* @return string Category description, available.
|
||||
*/
|
||||
function category_description( $category = 0 ) {
|
||||
global $cat;
|
||||
if ( !$category )
|
||||
$category = $cat;
|
||||
|
||||
return get_term_field( 'description', $category, 'category' );
|
||||
return term_description( $category, 'category' );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -798,6 +794,36 @@ function the_tags( $before = null, $sep = ', ', $after = '' ) {
|
||||
echo get_the_tag_list($before, $sep, $after);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve tag description.
|
||||
*
|
||||
* @since 2.8
|
||||
*
|
||||
* @param int $tag Optional. Tag ID. Will use global tag ID by default.
|
||||
* @return string Tag description, available.
|
||||
*/
|
||||
function tag_description( $tag = 0 ) {
|
||||
return term_description( $tag );
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve term description.
|
||||
*
|
||||
* @since 2.8
|
||||
*
|
||||
* @param int $term Optional. Term ID. Will use global term ID by default.
|
||||
* @return string Term description, available.
|
||||
*/
|
||||
function term_description( $term = 0, $taxonomy = 'post_tag' ) {
|
||||
if ( !$term && ( is_tax() || is_tag() || is_category() ) ) {
|
||||
global $wp_query;
|
||||
$term = $wp_query->get_queried_object();
|
||||
$taxonomy = $term->taxonomy;
|
||||
$term = $term->term_id;
|
||||
}
|
||||
return get_term_field( 'description', $term, $taxonomy );
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the terms of the taxonomy that are attached to the post.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user