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.
定义位置
  • wp-includes/theme.php
    , line 3131
引入
2.9.0
弃用

Checks a theme’s support for a given feature before loading the functions which implement it.

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