require_if_theme_supports()

最后更新于:2021-11-27 21:46:38

require_if_theme_supports( string$feature, string$include)

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

参数

$feature

(string) (Required) The feature being checked. See add_theme_support() for the list of possible values.

$include

(string) (Required) Path to the file.

响应

(bool) True if the current theme supports the supplied feature, false otherwise.

源文件

文件: gc-includes/theme.php

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