get_theme_data

Retrieve theme data from parsed theme file.

Description

(array) get_theme_data( (string) $theme_file ); 

Returns (array)

Theme data.

Parameters (1)

0. $theme_file (string)
Theme file path.

Usage

  1. if ( !function_exists( 'get_theme_data' ) ) { 
  2. require_once ABSPATH . WPINC . '/deprecated.php'; 
  3.  
  4. // Theme file path. 
  5. $theme_file = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = get_theme_data($theme_file); 
  9.  

Defined (1)

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

/wp-includes/deprecated.php  
  1. function get_theme_data( $theme_file ) { 
  2. _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' ); 
  3. $theme = new WP_Theme( basename( dirname( $theme_file ) ), dirname( dirname( $theme_file ) ) ); 
  4.  
  5. $theme_data = array( 
  6. 'Name' => $theme->get('Name'),  
  7. 'URI' => $theme->display('ThemeURI', true, false),  
  8. 'Description' => $theme->display('Description', true, false),  
  9. 'Author' => $theme->display('Author', true, false),  
  10. 'AuthorURI' => $theme->display('AuthorURI', true, false),  
  11. 'Version' => $theme->get('Version'),  
  12. 'Template' => $theme->get('Template'),  
  13. 'Status' => $theme->get('Status'),  
  14. 'Tags' => $theme->get('Tags'),  
  15. 'Title' => $theme->get('Name'),  
  16. 'AuthorName' => $theme->get('Author'),  
  17. ); 
  18.  
  19. foreach ( apply_filters( 'extra_theme_headers', array() ) as $extra_header ) { 
  20. if ( ! isset( $theme_data[ $extra_header ] ) ) 
  21. $theme_data[ $extra_header ] = $theme->get( $extra_header ); 
  22.  
  23. return $theme_data;