the_date
云策文档标注
概述
the_date 是一个 WordPress 过滤器,用于修改文章日期在显示时的格式化输出。它允许开发者自定义日期字符串、格式以及前后 HTML 包装。
关键要点
- 过滤器名称:'the_date',用于过滤文章日期显示。
- 参数:包括 $the_date(格式化日期字符串)、$format(PHP 日期格式)、$before(日期前 HTML 输出)、$after(日期后 HTML 输出)。
- 用法:通过 apply_filters 调用,可结合 the_date() 函数使用,实现日期显示的自定义。
- 相关函数:the_date() 用于显示或检索文章日期,每个日期仅显示一次。
- 版本历史:自 WordPress 0.71 版本引入。
原文内容
Filters the date of the post, for display.
Parameters
$the_datestring-
The formatted date string.
$formatstring-
PHP date format.
$beforestring-
HTML output before the date.
$afterstring-
HTML output after the date.
Source
$the_date = apply_filters( 'the_date', $the_date, $format, $before, $after );
Changelog
| Version | Description |
|---|---|
| 0.71 | Introduced. |