is_year

函数
is_year ( No parameters )
返回值
  • (bool) Whether the query is for an existing year archive.
定义位置
相关方法
is_searchis_termis_erroris_emailis_author
引入
1.5.0
弃用
-

is_year: 这是WordPress中的一个函数,用来检查当前的查询是否是一个年份的档案。如果当前的查询是针对一年的档案,则返回真。

确定查询是否是针对现有的年份档案。

关于这个和类似主题函数的更多信息,请查看《主题开发者手册》中的{@link Conditional Tags}文章。

function is_year() {
	global $wp_query;

	if ( ! isset( $wp_query ) ) {
		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
		return false;
	}

	return $wp_query->is_year();
}

常见问题

FAQs
查看更多 >
闪电侠

(工作日 10:00 - 18:30 为您服务)

2025-12-05 16:32:56

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: