require_if_theme_supports()加载主题支持的所有函数

目录

描述

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

require_if_theme_supports() 描述

用法

<?php require_if_theme_supports$feature$include ?>

require_if_theme_supports() 用法

参数

$feature

(string) (必填) the feature being checked

默认值: None

$include

(string) (必填) the file containing the functions that implement the feature

默认值: None

require_if_theme_supports() 参数

返回值

(boolean) 

This function returns a boolean (true|false).

require_if_theme_supports() 返回值

历史

添加于 版本: 2.9.0

require_if_theme_supports() 历史

源文件

require_if_theme_supports() 函数的代码位于 wp-includes/theme.php.

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */
/**
 * 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;
}

require_if_theme_supports() 源文件