Introduce require_if_theme_supports(), move post thumbnails functions to there own include and only included them if the theme supports them. See #10928 and [12132]
git-svn-id: http://svn.automattic.com/wordpress/trunk@12134 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -1305,6 +1305,8 @@ function add_custom_image_header($header_callback, $admin_header_callback) {
|
||||
|
||||
/**
|
||||
* Allows a theme to register its support of a certain feature
|
||||
*
|
||||
* Must be called in the themes functions.php file to work.
|
||||
*
|
||||
* @author Mark Jaquith
|
||||
* @since 2.9
|
||||
@@ -1329,4 +1331,17 @@ function current_theme_supports( $feature ) {
|
||||
return ( isset( $_wp_theme_features[$feature] ) && $_wp_theme_features[$feature] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks a theme's support for a given feature before loading the functions which implement it.
|
||||
*
|
||||
* @author Peter Westwood
|
||||
* @since 2.9
|
||||
* @param string $feature the feature being checked
|
||||
* @param string $include the file containing the functions that implement the feature
|
||||
*/
|
||||
function require_if_theme_supports( $feature, $include) {
|
||||
if ( current_theme_supports( $feature ) )
|
||||
require ( $include );
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user