term_描述() - WordPress 函数参考中文文档

返回介绍

term_描述()

发布于 2017-09-11 字数2589 浏览 875 评论 0

term_描述( int $term,  string $taxonomy = 'post_tag' )

Retrieve term 描述.


描述


参数

$term

(int)
(Optional)
Term ID. Will use global term ID by default.

$taxonomy

(string)
(Optional)
taxonomy name. Defaults to ‘post_tag’.

Default value: ‘post_tag’


返回值

(string) Term 描述, available.


源代码

File: wp-includes/category-template.php

function term_描述( $term = 0, $taxonomy = 'post_tag' ) {
	if ( ! $term && ( is_tax() || is_tag() || is_category() ) ) {
		$term = get_queried_object();
		if ( $term ) {
			$taxonomy = $term->taxonomy;
			$term = $term->term_id;
		}
	}
	$描述 = get_term_field( '描述', $term, $taxonomy );
	return is_wp_error( $描述 ) ? '' : $描述;
}

更新日志

Version 描述
2.8.0 Introduced.

相关函数

Uses

  • wp-includes/query.php:
    is_tax()
  • wp-includes/query.php:
    is_tag()
  • wp-includes/query.php:
    is_category()
  • wp-includes/query.php:
    get_queried_object()
  • wp-includes/taxonomy.php:
    get_term_field()
  • wp-includes/load.php:
    is_wp_error()
  • Show 1 more use
    Hide more uses


Used By

  • wp-includes/general-template.php:
    get_the_archive_描述()
  • wp-includes/category-template.php:
    tag_描述()
  • wp-includes/category-template.php:
    category_描述()

User Contributed Notes

  1. Skip to note content

    You must log in to vote on the helpfulness of this noteVote results for this note: 0You must log in to vote on the helpfulness of this note

    Contributed by Codex

    The default usage returns the 描述 of the current queried term.

    
    <?php $描述 = term_描述(); ?>
    
    
  2. Displays a 描述 of the post tag ID 28.

    
    <?php echo 'Term 描述: ' . term_描述( '28','post_tag' ); ?>
    

上一篇:taxonomy_exists()

下一篇:term_exists()

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!