钩子文档

the_time

💡 云策文档标注

概述

the_time 是一个 WordPress 过滤器,用于过滤文章的时间以便显示。它允许开发者自定义时间格式或修改时间字符串。

关键要点

  • 过滤器名称:the_time
  • 参数:$get_the_timestring(格式化后的时间字符串)和 $format(时间格式字符串)
  • 时间格式支持:'G'、'U' 或 PHP 日期格式
  • 源调用:echo apply_filters( 'the_time', get_the_time( $format ), $format )
  • 相关函数:the_time() 用于显示文章时间
  • 引入版本:0.71

📄 原文内容

Filters the time of the post, for display.

Parameters

$get_the_timestring
The formatted time.
$formatstring
Format to use for retrieving the time the post was written. Accepts 'G', 'U', or PHP date format.

Source

echo apply_filters( 'the_time', get_the_time( $format ), $format );

Changelog

Version Description
0.71 Introduced.