get_themes

Retrieve list of themes with theme data in theme directory.

Description

(array) get_themes(); 

The theme is broken, if it doesn't have a parent theme and is missing either style.css and, or index.php. If the theme has a parent theme then it is broken, if it is missing style.css; index.php is optional.

Returns (array)

Theme list with theme data.


Usage

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

Defined (1)

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

/wp-includes/deprecated.php  
  1. function get_themes() { 
  2. _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_themes()' ); 
  3.  
  4. global $wp_themes; 
  5. if ( isset( $wp_themes ) ) 
  6. return $wp_themes; 
  7.  
  8. $themes = wp_get_themes(); 
  9. $wp_themes = array(); 
  10.  
  11. foreach ( $themes as $theme ) { 
  12. $name = $theme->get('Name'); 
  13. if ( isset( $wp_themes[ $name ] ) ) 
  14. $wp_themes[ $name . '/' . $theme->get_stylesheet() ] = $theme; 
  15. else 
  16. $wp_themes[ $name ] = $theme; 
  17.  
  18. return $wp_themes;