require_if_theme_supports

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

Description

require_if_theme_supports( (string) $feature, (string) $include ); 

Parameters (2)

0. $feature (string)
The feature being checked.
1. $include (string)
Path to the file.

Usage

  1. if ( !function_exists( 'require_if_theme_supports' ) ) { 
  2. require_once ABSPATH . WPINC . '/theme.php'; 
  3.  
  4. // The feature being checked. 
  5. $feature = ''; 
  6.  
  7. // Path to the file. 
  8. $include = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = require_if_theme_supports($feature, $include); 
  12.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/theme.php  
  1. function require_if_theme_supports( $feature, $include ) { 
  2. if ( current_theme_supports( $feature ) ) { 
  3. require ( $include ); 
  4. return true; 
  5. return false;