WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/get theme data


This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists. See also wp-includes/deprecated.php. Use wp_get_theme instead.

Description

Returns an array of information about a theme file.

This function has been replaced with wp_get_theme in WordPress 3.4

Usage

 <?php get_theme_data$theme_filename ); ?> 

Use wp_get_theme instead.

Parameters

$theme_filename
(string) (required) Path and filename of the theme's style.css.
Default: None

Return values

(array)
The function returns an array containing the following keyed information:
'Name' 
(string) The Themes name.
'Title' 
(string) Either the Theme's name or a HTML fragment containg the Theme's name linked to the Theme's URI if the Theme's URI is defined.
'URI' 
(string) The Themes URI.
'Description' 
(string) A HTML fragment containg the Themes description after it has passed through wptexturize.
'AuthorURI' 
(string) The Theme's Author URI.
'Template' 
(string) The name of the parent Theme if one exists.
'Version' 
(string) The Theme's version number.
'Status' 
(string) the Theme's Status (defaults to 'publish')
'Tags' 
(string) the Theme's Tags
'Author' 
(string) Either the Author's name or a HTML fragment containing the Author's name linked to the Author's URI if the Author's URI is defined.

Example

Usage

Get the information from the theme's style.css and display the Theme Name and Author.

<?php

    /*
     * Assign theme folder name that you want to get information.
     * make sure theme exist in wp-content/themes/ folder.
     */

    $theme_name = 'twentyeleven'; 

    /*
    * Do not use get_stylesheet_uri() as $theme_filename,
    * it will result in PHP fopen error if allow_url_fopen is set to Off in php.ini,
    * which is what most shared hosting does. You can use get_stylesheet_directory()
    * or get_template_directory() though, because they return local paths.
    */

    $theme_data = get_theme_data( get_theme_root() . '/' . $theme_name . '/style.css' );
    echo $theme_data['Title'];
    echo $theme_data['Author'];

?>

Source File

get_theme_data() is located in wp-includes/deprecated.php.

Related

See also index of Function Reference and index of Template Tags.