require_if_theme_supports()
Checks a theme's support for a given feature before loading the functions which implement it.
No Hooks.
Returns
true|false. True if the active theme supports the supplied feature, false otherwise.
Usage
require_if_theme_supports( $feature, $file );
- $feature(string) (required)
- The feature being checked. See add_theme_support() for the list of possible values.
- $file(string) (required)
- Path to the file.
Changelog
| Since 2.9.0 | Introduced. |
require_if_theme_supports() require if theme supports code WP 7.0
function require_if_theme_supports( $feature, $file ) {
if ( current_theme_supports( $feature ) ) {
require $file;
return true;
}
return false;
}