the_archive_description()
云策文档标注
概述
the_archive_description() 是一个 WordPress 模板函数,用于显示分类、标签、术语或作者存档的描述。它基于 get_the_archive_description() 获取描述内容,并允许通过参数添加前缀和后缀。
关键要点
- 函数用于输出存档描述,适用于分类、标签、术语或作者页面。
- 接受两个可选参数:$before(前缀)和 $after(后缀),默认为空字符串。
- 内部调用 get_the_archive_description() 获取描述,仅在描述存在时输出。
- 首次引入于 WordPress 4.1.0 版本。
- 相关函数包括 get_the_archive_description() 和 the_archive_title()。
代码示例
the_archive_description( '', '' );
原文内容
Displays category, tag, term, or author description.
Description
See also
Parameters
$beforestringoptional-
Content to prepend to the description. Default empty.
$afterstringoptional-
Content to append to the description. Default empty.
Source
function the_archive_description( $before = '', $after = '' ) {
$description = get_the_archive_description();
if ( $description ) {
echo $before . $description . $after;
}
}
Changelog
| Version | Description |
|---|---|
| 4.1.0 | Introduced. |
Skip to note 3 content
rabmalin
Display archive description.
the_archive_description( '<div class="taxonomy-description">', '</div>' );Skip to note 4 content
Anthony Hortin
See Also
the_archive_title() – Display the archive title based on the queried object