require_if_theme_supports

函数
require_if_theme_supports ( $feature, $include )
参数
  • (string) $feature The feature being checked. See add_theme_support() for the list of possible values.
    Required:
  • (string) $include Path to the file.
    Required:
返回值
  • (bool) True if the active theme supports the supplied feature, false otherwise.
定义位置
相关方法
remove_theme_support_remove_theme_supportcurrent_theme_supportsget_theme_supportadd_theme_support
引入
2.9.0
弃用
-

require_if_theme_supports。如果某个主题支持功能被启用,这个函数用于包含一个文件。它通常用于加载特定主题的功能或样式表。

在加载实现该功能的函数之前,检查主题对某一特定功能的支持。

function require_if_theme_supports( $feature, $include ) {
	if ( current_theme_supports( $feature ) ) {
		require $include;
		return true;
	}
	return false;
}

常见问题

FAQs
查看更多 >
闪电侠

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

2026-03-15 14:37:20

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

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

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