require_if_theme_supports()WP 2.9.0

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

Хуков нет.

Возвращает

true|false. True if the active theme supports the supplied feature, false otherwise.

Использование

require_if_theme_supports( $feature, $file );
$feature(строка) (обязательный)
The feature being checked. See add_theme_support() for the list of possible values.
$file(строка) (обязательный)
Path to the file.

Список изменений

С версии 2.9.0 Введена.

Код require_if_theme_supports() WP 6.5.2

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