首页>文档>Wordpress开发文档>Wordpress 函数>require_if_theme_supports()

require_if_theme_supports()

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

require_if_theme_supports( string $feature,string $include )

参数(Parameters)

参数类型必填说明
$feature(string)必需正在检查的功能。
$include(string)必需文件的路径。

返回(Return)

(bool)如果当前主题支持提供的功能,则为True,否则为false。


源码(Source)

/**
 * Checks a theme's support for a given feature before loading the functions which implement it.
 *
 * @since 2.9.0
 *
 * @param string $feature The feature being checked.
 * @param string $include Path to the file.
 * @return bool True if the current theme supports the supplied feature, false otherwise.
 */
function require_if_theme_supports( $feature, $include ) {
	if ( current_theme_supports( $feature ) ) {
		require ( $include );
		return true;
	}
	return false;
}
更新版本源码位置使用被使用
2.9.0wp-includes/theme.php:289901 function
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索