get_calendar_args
云策文档标注
概述
本文档介绍了 get_calendar_args 过滤器,用于在 get_calendar 函数使用参数前进行过滤。该过滤器允许开发者修改日历生成的参数,如初始设置、显示选项和文章类型。
关键要点
- get_calendar_args 是一个过滤器,用于修改 get_calendar 函数的参数。
- 参数包括 $args(参数数组)、initial(是否使用初始日历名称,默认 true)、display(是否显示日历输出,默认 true)和 post_type(文章类型,默认 'post')。
- 过滤器在 wp-includes/general-template.php 中定义,通过 apply_filters 调用。
- 该过滤器从 WordPress 6.8.0 版本开始引入。
代码示例
$args = apply_filters( 'get_calendar_args', wp_parse_args( $args, $defaults ) );
原文内容
Filter the get_calendar function arguments before they are used.
Parameters
$argsarray-
Arguments for the
get_calendarfunction.initialboolWhether to use initial calendar names. Default true.displayboolWhether to display the calendar output. Default true.post_typestringOptional. Post type. Default'post'.
Source
$args = apply_filters( 'get_calendar_args', wp_parse_args( $args, $defaults ) );
Changelog
| Version | Description |
|---|---|
| 6.8.0 | Introduced. |